Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: esttab command, switch order of model labels and model numbers


From   Santosh Anagol <[email protected]>
To   statalist <[email protected]>
Subject   st: esttab command, switch order of model labels and model numbers
Date   Thu, 30 May 2013 15:34:02 -0400

I am using the esttab command to automate latex table production. I
would like to label the models (columns) with groups, model names, and
model numbers. I would like the group names to be the top row, model
names to be the 2nd row, and model numbers to be the third row.

However, the default in esttab appears to be to always put the model
names below the model numbers. Is there a way for esttab to put the
model labels in the order I would like? Here's an example where I'd
like the labels A B C D to be the 2nd row and the model numbers to be
the third row:

sysuse auto

eststo b1: reg price mpg
eststo b2: reg price mpg weight
eststo b3: reg price mpg if foreign == 1
eststo b4: reg price mpg weight if foreign == 1

esttab b1 b2 b3 b4 using col_example.tex, ///
mgroups("All Cars" "Foreign Cars", span begin("Car Type")
prefix(\multicolumn{@span}{c}{) suffix(}) pattern(1 0 1 0)) ///
replace mlabels("A" "B" "C" "D")


TEX OUTPUT:

{

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

\begin{tabular}{l*{4}{c}}

\hline\hline

Car Type &\multicolumn{2}{c}{All Cars} &\multicolumn{2}{c}{Foreign Cars} \\

&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)}
&\multicolumn{1}{c}{(3)} &\multicolumn{1}{c}{(4)} \\

& A & B & C & D \\

\hline

mpg & -238.9\sym{***}& -49.51 & -250.4\sym{**} & -19.78 \\

& (-4.50) & (-0.57) & (-3.64) & (-0.34) \\

[1em]

weight & & 1.747\sym{**} & & 5.156\sym{***}\\

& & (2.72) & & (5.85) \\

[1em]

\_cons & 11253.1\sym{***}& 1946.1 & 12587.0\sym{***}& -5065.8 \\

& (9.61) & (0.54) & (7.15) & (-1.58) \\

\hline

\(N\) & 74 & 74 & 22 & 22 \\

\hline\hline

\multicolumn{5}{l}{\footnotesize \textit{t} statistics in parentheses}\\

\multicolumn{5}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**}
\(p<0.01\), \sym{***} \(p<0.001\)}\\

\end{tabular}

}


Thanks,

Santosh
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index