Hello everyone,
I am running some regressions in Stata and use esttab to output the results into a Latex table.
I attach here the table that I get. But when I include that table into my tex document I get the following error:
table/mutual_fund_regression.tex
! Package array Error: Illegal pream-token (D): `c' used.
See the array package documentation for explanation.
Type H <return> for immediate help.
...
l.3 \begin{tabular}{l*{2}{D{.}{.}{-1}}}
?
Any ideas what the problem is here and how it can be fixed?
Many thanks in advance
Costas Antoniou
Graphics, Figures & Tables ⇒ Table from Stata
-
- Posts: 1
- Joined: Wed May 03, 2023 10:40 am
Table from Stata
- Attachments
-
- mutual_fund_regression.tex
- (1.07 KiB) Downloaded 141 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Table from Stata
Hi Costas,
welcome to the forum!
The problem in this line
You can write, for example,
Stefan
welcome to the forum!
The problem in this line
\begin{tabular}{l*{2}{D{.}{.}{-1}}}
is, that the D column type is not defined.You can write, for example,
\begin{tabular}{l*{2}{c}}
instead.Stefan
LaTeX.org admin
Table from Stata
or add
KR
Rainer
\usepackage{dcolumn}
to your preamble, then a "D" column is specified 
KR
Rainer
- Stefan Kottwitz
- Site Admin
- Posts: 10321
- Joined: Mon Mar 10, 2008 9:44 pm
Table from Stata
Rainer's advice is the best, so our code runs as expected, and the numbers are aligned at the decimal point:
You may notice that the text in the math columns doesn't look good. You can improve it, for example, by using
Stefan
Code: Select all
\documentclass{article}
\usepackage{booktabs,dcolumn}
\begin{document}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{tabular}{l*{2}{D{.}{.}{-1}}}
\hline\hline
&\multicolumn{2}{c}{Proportion Sold} \\\cmidrule(lr){2-3}
&\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} \\
\hline
retpos & 0.032\sym{***}& \\
& (0.010) & \\
[1em]
retneg & 0.033\sym{**} & \\
& (0.016) & \\
[1em]
absret & & 0.009 \\
& & (0.010) \\
\hline
Observations & 1872832.000 & 1872832.000 \\
$R^2$ & 0.300 & 0.300 \\
Fund $\times$ Date F.E& F.E. "Yes" & F.E. "Yes" \\
Stock $\times$ year F.E.& F.E. "Yes" & F.E. "Yes" \\
Stock $\times$ date F.E.& F.E. "No" & \\
\hline\hline
\end{tabular}
}
\end{document}
\multicolumn
at such cells, like\multicolumn{1}{c}{F.E. "Yes"}
.Stefan
LaTeX.org admin