Hi,
I'm using Stata 15.1.
I use the following code to obtain a Latex table reporting the mean for a set of variables, in 8 columns (with the first 4 columns reporting stats for girls, the last 4 for boys).
The 1st column reports the mean of each variable for the whole girls' sample, the 2nd one for the girls from 10 to 14 years old, the 3rd one for the girls from 15 to 19 years old, and the last one for the girls from 20 to 24 years old. Same for the boys.
Nevertheless, the titles of my 8 columns remain "Total" in the Latex output file. Any idea why ?
I'm using Stata 15.1.
I use the following code to obtain a Latex table reporting the mean for a set of variables, in 8 columns (with the first 4 columns reporting stats for girls, the last 4 for boys).
The 1st column reports the mean of each variable for the whole girls' sample, the 2nd one for the girls from 10 to 14 years old, the 3rd one for the girls from 15 to 19 years old, and the last one for the girls from 20 to 24 years old. Same for the boys.
Nevertheless, the titles of my 8 columns remain "Total" in the Latex output file. Any idea why ?
est clear
global vars drawbacks_marr num_drawbacks_marr mst drawbacks_marr_child violence lost_child early_wid
***Girls
eststo m1: estpost sum $vars if sex==1
eststo m2: estpost sum $vars if sex==1 & age_ADO==0
eststo m3: estpost sum $vars if sex==1 & age_ADO==1
eststo m4: estpost sum $vars if sex==1 & age_ADO==2
***Boys
eststo m5: estpost sum $vars if sex==0
eststo m6: estpost sum $vars if sex==0 & age_ADO==0
eststo m7: estpost sum $vars if sex==0 & age_ADO==1
eststo m8: estpost sum $vars if sex==0 & age_ADO==2
*** Export to Latex format
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "$output_girls/Table1.tex", replace ///
cells("mean(pattern(1 1 1 1 1 1) fmt(2))") ///
collabels("Total" "10-14 ans" "15-19 ans" "20-24 ans" "Total" "10-14 ans" "15-19 ans" "20-24 ans") ///
star(* 0.10 ** 0.05 *** 0.01) ///
label booktabs nonum gaps noobs compress
global vars drawbacks_marr num_drawbacks_marr mst drawbacks_marr_child violence lost_child early_wid
***Girls
eststo m1: estpost sum $vars if sex==1
eststo m2: estpost sum $vars if sex==1 & age_ADO==0
eststo m3: estpost sum $vars if sex==1 & age_ADO==1
eststo m4: estpost sum $vars if sex==1 & age_ADO==2
***Boys
eststo m5: estpost sum $vars if sex==0
eststo m6: estpost sum $vars if sex==0 & age_ADO==0
eststo m7: estpost sum $vars if sex==0 & age_ADO==1
eststo m8: estpost sum $vars if sex==0 & age_ADO==2
*** Export to Latex format
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "$output_girls/Table1.tex", replace ///
cells("mean(pattern(1 1 1 1 1 1) fmt(2))") ///
collabels("Total" "10-14 ans" "15-19 ans" "20-24 ans" "Total" "10-14 ans" "15-19 ans" "20-24 ans") ///
star(* 0.10 ** 0.05 *** 0.01) ///
label booktabs nonum gaps noobs compress
Comment