Dear statalisters,
I used the below code to create a 3-way table with the columns of gender and the rows are year and marital3. I tabulated the mean of var1.
I tried to add another statistics in the coding but it did not work out.
i.e.:
c(mean var1 mean var2)
edit: I used the following reference for the coding: http://ianwatson.com.au/stata/tabout_tutorial.pdf
Any suggestions would be appreciated.
Many thanks,
Maye
I used the below code to create a 3-way table with the columns of gender and the rows are year and marital3. I tabulated the mean of var1.
Code:
** setup macros for loops levelsof year, local(levels) local yearlabels : value label year local counter = 0 local filemethod = "replace" local heading = "" ** begin looping through the values of the by category foreach l of local levels { if `counter' > 0 { local filemethod = "append" local heading = "h1(nil) h2(nil)" } local vlabel : label `yearlabels' `l' tabout marital3 gender if year == `l' [aw=panel_wt_06_12] using "tabletrial3.xls", `filemethod' /// sum c(mean var1) `heading' h3("`vlabel'") f(0c) local counter = `counter' + 1 }
i.e.:
c(mean var1 mean var2)
edit: I used the following reference for the coding: http://ianwatson.com.au/stata/tabout_tutorial.pdf
Any suggestions would be appreciated.
Many thanks,
Maye
Comment