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.
Related Posts with Tabstat tables side by side using esttab in a loop
Dealing with a variable that has both numeric and categorical observationsHi everyone. I am new to this site so please bear with me. I am running a regression of property va…
Stata 15 crashes when using unicode translateDear community, I am using Chinese panel data for 2012 and 2014 and I've been using the Code: uni…
Out of sample cross-validation for counts data, am I correct?Dear all, I am working on counts data and my study is to compare performance of several models that…
Hierarchical anycountDear all, I have 2 sets of 8 variables and want to do egen x = anycount(varlist) values(1 3 6 7…
Issue with rename on a foreach loopHi I am trying to start a loop so that I can rename my variables. I tried using the same format I …
Subscribe to:
Post Comments (Atom)
0 Response to Tabstat tables side by side using esttab in a loop
Post a Comment