## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Issue with Table created from Stata Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
nica
Posts: 1
Joined: Thu Feb 21, 2013 3:33 am

### Issue with Table created from Stata

I'm new to LaTeX, and I've been messing around with "eststo" and "esttab" to get regression results from Stata to LaTeX without having to mess with the code too much in the LaTeX file.

Unfortunately, I'm running into a weird problem: I want to set the table to 'wide' using "esttab" (putting the SEs next to the estimated coefficients, rather than below), but when I do, LaTeX seems unhappy with the dcolumn package (to align the decimal points). When I typeset, it gives me this error.
117: Extra alignment tab has been changed to \cr. <template> \endtemplatel.117 ... &\multicolumn{2}{c}{(1)}    &    \multicolumn{2}{c}{(2)} ... ?

Here's the Stata command (if that's helpful):
esttab using /path/name.tex,  ///	label title("Title") mtitles("M1" "M2") ///	nodepvars se(3) b(3) ar2 r2 scalars(F) gaps replace wide booktabs alignment(D{.}{.}{-1})

And the start of the LaTeX output:

\begin{table}[htbp]\centering\def\sym#1{\ifmmode^{#1}\else$$^{#1}$$\fi}\caption{Title}\begin{tabular}{l*{2}{cc}}\toprule                     &\multicolumn{2}{c}{(1)}           &\multicolumn{2}{c}{(2)}           \\                     &\multicolumn{2}{c}{M1}  &\multicolumn{2}{c}{M2}  \\\midruleX1 &       0.657\sym{*}  &     (0.199)&       0.970\sym{*}  &     (0.298)\\

...

I originally suspected that changing the number of columns might have been the problem. I've looked into the dcolumn manual, but it didn't seem to help. Any suggestions would be much appreciated!
Last edited by localghost on Thu Feb 21, 2013 10:37 am, edited 1 time in total.
Reason: Source code has to be tagged as such to keep a post clear and legible (see Board Rules).

Tags:

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Please prepare a self-contained and minimal example to give an adequate problem description. And perhaps you can avoid abbreviations like SE which nobody else than you knows.

Best regards and welcome to the board
Thorsten
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

sjhunk
Posts: 1
Joined: Wed Mar 13, 2013 6:28 pm
same problem here, did you find a solution?

SE stands for standard errors.

short097
Posts: 1
Joined: Tue Mar 07, 2017 10:46 pm
I also just encountered this specific issue and now have the solution:

If you use the wide option you need to provide 2 column specifiers within the alignment() option.
See the description of the alignment option in help esttab:
"If the table contains multiple columns per model/equation, the alignment specification should define all columns. For example, if the wide option is specified, you could type alignment(cr) to, say, center the point estimates and right-align the t-statistics."

In the original question, for the Stata code you want something like this if you want both the point estimates and t-stats to be aligned using dcolumn: alignment(D{.}{.}{-1} D{.}{.}{-1})