Reputation: 13
I am trying to have it so I have 3 different models each with two regressions underneath of them. Ideally I'd like the table columns to be organized like
Group 1 Group 2 Group 3
Reg1 Reg2 Reg3 Reg4 Reg5 Reg6
I tried coopting the code from this link but got an error saying
0.0179 & -0.0149\sym {**} & 0.0320 & 0.00967 & 0.0320 & 0.00967 \\ & \ETC.
! File ended while scanning use of \@@@cmidrule.
<inserted text>
\par
<*> test.tex
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
My code with all packages I'm using is
\documentclass[AER,reviewmode]{AEA}
\usepackage{natbib}
\usepackage{subfiles}
\usepackage{graphicx}
\graphicspath{{images/}{../images/}}
\usepackage{amsmath,amsfonts}
\usepackage{mathptmx}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{dcolumn}
\begin{document}
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{IV Regression Results, 1990\label{tab2}}
\begin{tabular}{l*{6}{D{.}{.}{-1}}}
\toprule
&\multicolumn{2}{c}{OLS} &\multicolumn{2}{c}{First Stage} &\multicolumn{2}{c}{Second Stage} \\\cmidrule(lr){@spam}\cmidrule(lr){@spam}\cmidrule(lr){@spam}
&\multicolumn{1}{c}{Isolation, 1990}&\multicolumn{1}{c}{Dissimilarity, 1990}&\multicolumn{1}{c}{Isolation, 1990}&\multicolumn{1}{c}{Dissimilarity, 1990}&\multicolumn{1}{c}{Isolation, 1990}&\multicolumn{1}{c}{Dissimilarity, 1990}\\
\midrule
Housing Supply Elasticity& -0.0179 & -0.0149\sym{**} & 0.0320 & 0.00967 & 0.0320 & 0.00967 \\
& (0.0116) & (0.00642) & (0.0373) & (0.0244) & (0.0373) & (0.0244) \\
\addlinespace
Population & 5.69e-08\sym{***}& 2.83e-08\sym{***}& 5.58e-08\sym{***}& 2.78e-08\sym{***}& 5.58e-08\sym{***}& 2.78e-08\sym{***}\\
& (1.26e-08) & (6.56e-09) & (1.05e-08) & (6.84e-09) & (1.05e-08) & (6.84e-09) \\
\addlinespace
WRLURI & -0.0757\sym{***}& -0.0503\sym{***}& 0.0742 & 0.0235 & 0.0742 & 0.0235 \\
& (0.0203) & (0.0126) & (0.109) & (0.0710) & (0.109) & (0.0710) \\
\addlinespace
Constant & 0.269\sym{***}& 0.580\sym{***}& 0.167\sym{**} & 0.530\sym{***}& 0.167\sym{**} & 0.530\sym{***}\\
& (0.0346) & (0.0198) & (0.0801) & (0.0524) & (0.0801) & (0.0524) \\
\midrule
Observations & 228 & 228 & 228 & 228 & 228 & 228 \\
\(R^{2}\) & 0.188 & 0.130 & . & 0.017 & . & 0.017 \\
Adjusted \(R^{2}\) & 0.177 & 0.119 & . & 0.004 & . & 0.004 \\
\bottomrule
\multicolumn{7}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{7}{l}{\footnotesize \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\
\end{tabular}
\end{table}
\end{document}
Upvotes: 1
Views: 847
Reputation: 168
It looks like you have a typo in your esttab command, though I can't tell for sure since you haven't posted that code. You want the range of columns in your \cmidrule
statement, e.g. \cmidrule(lr){2-3}
. The latex code you posted has \cmidrule(lr){@spam}
instead.
Note the apparent typo (@spam for @span). According to the estout documentation, using @span
within erepeat
should return the column range that you're looking for. So fixing the typo should do it.
Upvotes: 2
Reputation: 38818
Instead of @span
you should insert the range of columns the \cmidrule
is supposed to span:
\documentclass[AER,reviewmode]{AEA}
%\documentclass{article}
\usepackage{natbib}
\usepackage{subfiles}
\usepackage{graphicx}
\graphicspath{{images/}{../images/}}
\usepackage{amsmath,amsfonts}
\usepackage{mathptmx}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{dcolumn}
\begin{document}
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{IV Regression Results, 1990\label{tab2}}
\begin{tabular}{l*{6}{D{.}{.}{-1}}}
\toprule
&\multicolumn{2}{c}{OLS} &\multicolumn{2}{c}{First Stage} &\multicolumn{2}{c}{Second Stage} \\\cmidrule(lr){2-3}\cmidrule(lr){4-5}\cmidrule(lr){6-7}
&\multicolumn{1}{c}{Isolation, 1990}&\multicolumn{1}{c}{Dissimilarity, 1990}&\multicolumn{1}{c}{Isolation, 1990}&\multicolumn{1}{c}{Dissimilarity, 1990}&\multicolumn{1}{c}{Isolation, 1990}&\multicolumn{1}{c}{Dissimilarity, 1990}\\
\midrule
Housing Supply Elasticity& -0.0179 & -0.0149\sym{**} & 0.0320 & 0.00967 & 0.0320 & 0.00967 \\
& (0.0116) & (0.00642) & (0.0373) & (0.0244) & (0.0373) & (0.0244) \\
\addlinespace
Population & 5.69e-08\sym{***}& 2.83e-08\sym{***}& 5.58e-08\sym{***}& 2.78e-08\sym{***}& 5.58e-08\sym{***}& 2.78e-08\sym{***}\\
& (1.26e-08) & (6.56e-09) & (1.05e-08) & (6.84e-09) & (1.05e-08) & (6.84e-09) \\
\addlinespace
WRLURI & -0.0757\sym{***}& -0.0503\sym{***}& 0.0742 & 0.0235 & 0.0742 & 0.0235 \\
& (0.0203) & (0.0126) & (0.109) & (0.0710) & (0.109) & (0.0710) \\
\addlinespace
Constant & 0.269\sym{***}& 0.580\sym{***}& 0.167\sym{**} & 0.530\sym{***}& 0.167\sym{**} & 0.530\sym{***}\\
& (0.0346) & (0.0198) & (0.0801) & (0.0524) & (0.0801) & (0.0524) \\
\midrule
Observations & 228 & 228 & 228 & 228 & 228 & 228 \\
\(R^{2}\) & 0.188 & 0.130 & . & 0.017 & . & 0.017 \\
Adjusted \(R^{2}\) & 0.177 & 0.119 & . & 0.004 & . & 0.004 \\
\bottomrule
\multicolumn{7}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{7}{l}{\footnotesize \sym{*} \(p<0.10\), \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\
\end{tabular}
\end{table}
\end{document}
Upvotes: 1