2
votes

I have a simple but strange issue cropping up when I use esttab to export results from Stata into LaTeX.

Once the output is stored in the tex file I import the file into Lyx. However all coefficients are preceded by [em1] which complies as text in the pdf. Even if I don't import the tex file into Lyx and open it in Texworks, the [em1] prefix still appears. The only way I can find to remove the [em1] is manually which is tedious and lacks elegance.

Any ideas why this appears?

Here's the generating code:

svyset w1_wgt
estpost  svy: tab reason1, se per
est store w1, title(Model 1)

svyset w2_wgt
estpost  svy: tab reason2, se per
est store w2

svyset w3_wgt
estpost  svy: tab reason3, se per
est store w3

esttab w1 w2 w3 ///
using "Output/Descriptive Statistics/Absence of Adults.tex" ///
, replace nostar se unstack label  tex
2

2 Answers

2
votes

This doesn't answer your question, but you can use filefilter to get rid of the undesired text:

clear all
set more off

eststo clear
webuse nhanes2f

svyset psuid

svy: tab sex, se per
est store w1

svy: tab race, se per
est store w2

svy: tab region, se per
est store w3

esttab w1 w2 w3 using "D:/Desktop/statatemps/Absence.tex", ///
    replace nostar se unstack label tex

filefilter ///
    "D:/Desktop/statatemps/Absence.tex" ///
        "D:/Desktop/statatemps/Absence2.tex", from("[1em]") to("")
0
votes

Try working with outreg instead. Following @RobertoFerrer's example (thanks for giving some working code), you can use outreg instead of esttab:

outreg using "C:\...\Absence2.tex", replace nostar se tex 

Then just play with the formatting options in outreg. If it has what you need, this might be an easier way to achieve what you want. I have always found esttab to be better for these tabulations when I need them in MS Excel and outreg better for TeX. Just IMO, though.