Hi,
I am new to this forum and unfamiliar with a lot of stata functions so please bear with me. I would like to create an excel file which has the frequencies (with percent in brackets) of 90 or so survey questions each with the same five response options. Essentially creating a large table that pulls out the results of 90 one way tables. I have worked out how to do (some of) this in a very slow manner as follows
putexcel set Table1.xlsx, sheet(Sheet1) replace
tabulate q1, matcell(freq) matrow(names)
putexcel B1 = "Question 1"
putexcel A2 = matrix(names) B2 = matrix(freq)
tabulate q2, matcell(freq) matrow(names)
putexcel C1 = "Question 2"
putexcel C2 = matrix(freq)
etc...
Actually this is not exactly what I want, I would like each question to be a row, and the columns the response options 0, 1, 2, 3, or 4.
e.g.
Question | 0 | 1 | 2 | 3 | 4
q1 | 20 (20.0) | 20 (20.0) | 20 (20.0) | 20 (20.0)
I am struggling to work out how to pull out the frequencies and % and input them in to the excel in this format. Is there a foreach loop I can use for this to speed up the process for 90 questions?
Thanks for your help.
Tess
I am new to this forum and unfamiliar with a lot of stata functions so please bear with me. I would like to create an excel file which has the frequencies (with percent in brackets) of 90 or so survey questions each with the same five response options. Essentially creating a large table that pulls out the results of 90 one way tables. I have worked out how to do (some of) this in a very slow manner as follows
putexcel set Table1.xlsx, sheet(Sheet1) replace
tabulate q1, matcell(freq) matrow(names)
putexcel B1 = "Question 1"
putexcel A2 = matrix(names) B2 = matrix(freq)
tabulate q2, matcell(freq) matrow(names)
putexcel C1 = "Question 2"
putexcel C2 = matrix(freq)
etc...
Actually this is not exactly what I want, I would like each question to be a row, and the columns the response options 0, 1, 2, 3, or 4.
e.g.
Question | 0 | 1 | 2 | 3 | 4
q1 | 20 (20.0) | 20 (20.0) | 20 (20.0) | 20 (20.0)
I am struggling to work out how to pull out the frequencies and % and input them in to the excel in this format. Is there a foreach loop I can use for this to speed up the process for 90 questions?
Thanks for your help.
Tess