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
Loop a time-series regression to predict out-of-sample valuesHello there, I am quite new to Stata and after desperately searching for a solution in this forum I …
How spatial panel data models deal with endogeneity problem?Hi everyone, I am looking for your suggestion about how to deal with endogeneity bias which comes f…
Panel data and autocorrelationDo panel data need autocorrelation? …
assessment of similarity of baseline covariates after performing propensity score analysisDear I am Hatem Ali. I have 2 groups of patients, one received basiliximab induction therapy and the…
Loop a regression to predict out-of-sample valuesHello there, I am quite new to Stata and after desperately searching for a solution in this forum I …
Subscribe to:
Post Comments (Atom)
0 Response to Tabstat tables side by side using esttab in a loop
Post a Comment