LaTeX forum ⇒ Graphics, Figures & TablesIssue 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

Postby nica » Thu Feb 21, 2013 3:53 am

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.
  1. 117: Extra alignment tab has been changed to \cr. <template> \endtemplate
  2. l.117 ... &\multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} ... ?


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

And the start of the LaTeX output:

  1. \begin{table}[htbp]\centering
  2. \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
  3. \caption{Title}
  4. \begin{tabular}{l*{2}{cc}}
  5. \toprule
  6. &\multicolumn{2}{c}{(1)} &\multicolumn{2}{c}{(2)} \\
  7. &\multicolumn{2}{c}{M1} &\multicolumn{2}{c}{M2} \\
  8. \midrule
  9. X1 & 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:

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Thu Feb 21, 2013 10:32 am

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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ 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

Postby sjhunk » Wed Mar 13, 2013 6:29 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

Postby short097 » Tue Mar 07, 2017 11:36 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})


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 12 guests