Search code examples
latexregressionstata

In Stata's esttab, omit line of model names


I'm using Stata to produce regression tables with esttab and I want to include these tables in my Latex document.

I'm producing a regression table like this:

sysuse auto
eststo: regress price weight 
eststo: regress price weight mpg
eststo: regress price weight mpg headroom
eststo: regress price weight mpg length
esttab using "test.tex", nocons b(a2) replace stats(N r2, labels("Obs." "R$^2$")) nonumbers fragment booktabs 

Then I use the following Latex code to produce my table:

\documentclass[11pt, a4paper]{article}

\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}

\begin{document}

\begin{table}[!t]
\begin{small}
\begin{threeparttable}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{lllll}
\toprule
& \multicolumn{4}{c}{\textit{Dep. var: } price in dollars} \\
\cline{2-5} 
 & (1) & (2) & (3) & (4)\\
 \midrule
\input{test.tex}
\bottomrule
\end{tabular}
}
\end{threeparttable}
\begin{tablenotes}
\item\textit{Note:} Here I'm putting many great comments about my regression setup. *** p$<$0.01, ** p$<$0.05, * p$<$0.1.
\end{tablenotes}
\end{small}
\end{table}

\end{document}

Which produces:

enter image description here

All my problems would be solved if I could simply tell esttab not to produce this row of model names.

Any ideas?


Edit: The problem how to get rid of the line of model names was answered below by Eric HB. The follow-up problem of how to include Latex code starting with \midrule was answered here.


Solution

  • Including the option nomtitles will do this for you, so your code will be:

    sysuse auto
    eststo: regress price weight mpg
    esttab using "test.tex", nocons b(a2) replace ///
       stats(N r2, labels("Obs." "R$^2$")) ///
       nonumbers fragment booktabs nomtitles
    

    From help esttab:

    nomtitles suppresses printing of model titles.