Skip to content

Instantly share code, notes, and snippets.

@luizaandrade
Last active January 9, 2019 21:47
Show Gist options
  • Save luizaandrade/a9b830f4284b414ffe8d8271a83cbbe9 to your computer and use it in GitHub Desktop.
Save luizaandrade/a9b830f4284b414ffe8d8271a83cbbe9 to your computer and use it in GitHub Desktop.
Export a LaTeX three part table using esttab
#delimit ;
esttab nocontrols controls mpg fixedeffects // Export three regressions
using "${output}/threeparttable.tex", // Saving to tbl_fittednote.tex
scalars("controls Model controls" "fe Make fixed effects") // Adding two lines to bottom of table
keep(foreign _cons) // Don't display fixed effect coefs
label se nomtitles replace nonotes compress // Layout options
postfoot("\hline\hline \end{tabular}} \begin{tablenotes} \footnotesize \item \lipsum[1] \end{tablenotes}") // Input LaTeX code for closing table
;
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{4}{c}}
\hline\hline
&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)} &\multicolumn{1}{c}{(4)} \\
\hline
Car type (1 = foreign)& 312.3 & 2774.0\sym{***}& 2615.7\sym{**} & 6692.0\sym{***}\\
& (754.4) & (772.1) & (767.4) & (1651.6) \\
[1em]
Constant & 6072.4\sym{***}& -11500.2\sym{**} & -2673.4 & 1982.2 \\
& (411.4) & (3472.3) & (6220.8) & (4579.7) \\
\hline
Observations & 74 & 74 & 74 & 74 \\
Model controls & No & Yes & Yes & Yes \\
Make fixed effects& No & No & No & Yes \\
\hline\hline \end{tabular}} \begin{tablenotes} \footnotesize \item \lipsum[1] \end{tablenotes}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment