Dear all,
I am quite new to stata and have what I think must be a silly problem. I want to export OLS regression results to latex and add a row with the means of the DV. Everything works fine with the exception that only the second mean shows up in the latex table, meaning that the first mean gets somehow overwritten when the second mean is generated. I am attaching the pdf with the table.
Here is what I am doing:
eststo clear
foreach var of varlist inq_problem deserve {
eststo: quietly xi: regress `var' treated i.fieldworker i.wave , robust
summarize `var', meanonly
scalar m`var' = r(mean)
estadd scalar m`var'
estadd local covars "Yes"
esttab using temp.tex, replace keep(treated ) ///
title("Title Here") nolabel ///
cells(b(star fmt(3)) se(par fmt(3))) nonumbers label compress ///
stats(m`var' covars N, fmt(2 "" 0) label("Control Group Mean" "Covariates" "Obs")) ///
addnote("Robust standard errors" ///
"Covariates: wave and fieldworker fixed effects" ///
"p-values: * 0.10 ** 0.05 *** 0.01") ///
star(* 0.10 ** 0.05 *** .01)
}
I patched this code together from various posts, so I don't understand exactly what is happening when in this code.
I would really appreciate your help!
Thanks a lot,
Eva
I am quite new to stata and have what I think must be a silly problem. I want to export OLS regression results to latex and add a row with the means of the DV. Everything works fine with the exception that only the second mean shows up in the latex table, meaning that the first mean gets somehow overwritten when the second mean is generated. I am attaching the pdf with the table.
Here is what I am doing:
eststo clear
foreach var of varlist inq_problem deserve {
eststo: quietly xi: regress `var' treated i.fieldworker i.wave , robust
summarize `var', meanonly
scalar m`var' = r(mean)
estadd scalar m`var'
estadd local covars "Yes"
esttab using temp.tex, replace keep(treated ) ///
title("Title Here") nolabel ///
cells(b(star fmt(3)) se(par fmt(3))) nonumbers label compress ///
stats(m`var' covars N, fmt(2 "" 0) label("Control Group Mean" "Covariates" "Obs")) ///
addnote("Robust standard errors" ///
"Covariates: wave and fieldworker fixed effects" ///
"p-values: * 0.10 ** 0.05 *** 0.01") ///
star(* 0.10 ** 0.05 *** .01)
}
I patched this code together from various posts, so I don't understand exactly what is happening when in this code.
I would really appreciate your help!
Thanks a lot,
Eva
Comment