Dear colleagues,
I am using Stata 17 to generate frequency tables for social indicators.
I would like to export the results to excel where for each category all dimensions' levels are there, even if there are no data.
For illustration (picture below), the table should have 326 rows by 13 columns, yet, the resulted table has 281 rows by 13 columns, for example, I need Stata to add 3 empty rows for "Not stated" & Married in "URBAN" area, and fill these rows with empty cells across the 13 columns.
I found that Stata can add zeros for missing cells, but this was only limited to regression tables and not applicable to frequency tables.
I am using the codes below, any feedback or thoughts would be highly appreciated.
Thank you,
Rabih.
I am using Stata 17 to generate frequency tables for social indicators.
I would like to export the results to excel where for each category all dimensions' levels are there, even if there are no data.
For illustration (picture below), the table should have 326 rows by 13 columns, yet, the resulted table has 281 rows by 13 columns, for example, I need Stata to add 3 empty rows for "Not stated" & Married in "URBAN" area, and fill these rows with empty cells across the 13 columns.
I found that Stata can add zeros for missing cells, but this was only limited to regression tables and not applicable to frequency tables.
I am using the codes below, any feedback or thoughts would be highly appreciated.
Thank you,
Rabih.
Code:
table (location marital_status disability sex) (age) () [pweight =weight], statistic(sumw) nformat( %9.0f sumw) missing name(table1)
collect style row split, delimiter(" # ") atdelimiter(" @ ") bardelimiter(" | ") binder("=") nospacer dups(repeat) position(left) span
collect layout (location[1 2 .m]#marital_status[1 2 3 4 5 6 .m]#disability[1 2 3 4 9 .m]#sex[1 2 .m]#result) (age) ()
