Hi everyone,
I am trying to get summary statistics of my variables using tabstat and would like to export the tables to an excel file. Since there are many variables, I used a loop. However, I want to like the tables for each variable side by side which is not happening. I tried a bunch of options but nothing seems to work out. This the latest code I tried:
eststo clear
local name1_11 "sex_ratio thh hh_memearn illiterate scst_hh lirrigated tpop scpop stpop men women trans working_age"
foreach name1_11 in sex_ratio thh hh_memearn illiterate scst_hh lirrigated tpop ///
scpop stpop men women trans working_age {
eststo `name1_11': estpost tabstat `name1_11', by(cpgender) stat(mean sd)
esttab `name1_11'* using summarystat5.csv, main(mean) aux(sd) coeflabels(0 "Female" 1 "Male") ///
collab(`name1_11') unstack
}
Please help.
0 Response to Tabstat tables side by side using esttab in a loop
Post a Comment