4

I am completely new to LaTeX. I work in the TeXworks editor. I would like to create regression tables with results from Stata for my master's thesis. Using the Stata command "esttab", I created a .tex file with code for my table, however when I try to typeset the table to a pdf document, i always get an "!Undefined control sequence" error.

The following is the .tex file which is created by Stata, I only added the "\documentclass{article}", "\usepackage{booktabs}", "\begin{document}" and "\end{document}" commands.

\documentclass{article}


\usepackage{booktabs}
\begin{document}

\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Regressions Strictly Independent\tab{tab1}}
\begin{tabular}{l*{2}{c}}
\toprule
                &\multicolumn{1}{c}{(1)}&\multicolumn{1}{c}{(2)}\\
                &\multicolumn{1}{c}{Linear Regression}&\multicolumn{1}{c} 
{Quadratic Regression}\\
\midrule
main                &                     &                     \\
Strictly Independent&   0.0000152         &                     \\
                &     (0.720)         &                     \\
\addlinespace
CEO\_Comp\_SHBased=0  &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
CEO\_Comp\_SHBased=1  &     -0.0106         &                     \\
                &     (0.110)         &                     \\
\addlinespace
Relative Deal Value &    -0.00958         &                     \\
                &     (0.118)         &                     \\
\addlinespace
Log Board Size      &     -0.0109\sym{*}  &                     \\
                &     (0.060)         &                     \\
\addlinespace
Log Market Cap Acq  &    -0.00177\sym{**} &                     \\
                &     (0.046)         &                     \\
\addlinespace
Average Director Tenure&    0.000415         &                     \\
                &     (0.381)         &                     \\
\addlinespace
CEO\_BM=0            &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
CEO\_BM=1            &    -0.00525         &                     \\
                &     (0.458)         &                     \\
\addlinespace
CEO\_Dual=0          &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
CEO\_Dual=1          &   -0.000284         &                     \\
                &     (0.902)         &                     \\
\addlinespace
Dummy\_Tar\_Listed=0  &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
Dummy\_Tar\_Listed=1  &    -0.00689\sym{***}&                     \\
                &     (0.007)         &                     \\
\addlinespace
Country\_Dummy=0     &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
Country\_Dummy=1     &    -0.00279         &                     \\
                &     (0.189)         &                     \\
\addlinespace
Industry\_Dummy=0    &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
Industry\_Dummy=1    &     0.00913\sym{**} &                     \\
                &     (0.020)         &                     \\
\addlinespace
Cash\_Dummy=0        &           0         &                     \\
                &         (.)         &                     \\
\addlinespace
Cash\_Dummy=1        &     0.00626\sym{*}  &                     \\
                &     (0.062)         &                     \\
\addlinespace
CEO\_Comp\_SHBased=0 $\times$ Avg\_Tenure&           0         &                     
\\
                &         (.)         &                     \\
\addlinespace
CEO\_Comp\_SHBased=1 $\times$ Avg\_Tenure&     0.00118\sym{*}  &                     
\\
                &     (0.067)         &                     \\
\addlinespace
Constant            &      0.0693\sym{***}&    0.000223\sym{*}  \\
                &     (0.001)         &     (0.092)         \\
\midrule
b2                  &                     &                     \\
Constant            &                     & -0.00000251\sym{*}  \\
                &                     &     (0.093)         \\
\midrule
b3                  &                     &                     \\
Constant            &                     &    0.000124         \\
                &                     &     (0.953)         \\
\midrule
b4                  &                     &                     \\
Constant            &                     &    -0.00965\sym{**} \\
                &                     &     (0.019)         \\
\midrule
b5                  &                     &                     \\
Constant            &                     &      0.0439\sym{**} \\
                &                     &     (0.011)         \\
\midrule
b6                  &                     &                     \\
Constant            &                     &     -0.0117\sym{***}\\
                &                     &     (0.001)         \\
\midrule
b7                  &                     &                     \\
Constant            &                     &    -0.00177\sym{**} \\
                &                     &     (0.042)         \\
\midrule
b8                  &                     &                     \\
Constant            &                     &    0.000844\sym{**} \\
                &                     &     (0.012)         \\
\midrule
b9                  &                     &                     \\
Constant            &                     &    -0.00615         \\
                &                     &     (0.466)         \\
\midrule
b10                 &                     &                     \\
Constant            &                     &   -0.000139         \\
                &                     &     (0.951)         \\
\midrule
b11                 &                     &                     \\
Constant            &                     &    -0.00710\sym{***}\\
                &                     &     (0.008)         \\
\midrule
b12                 &                     &                     \\
Constant            &                     &    -0.00268         \\
                &                     &     (0.246)         \\
\midrule
b13                 &                     &                     \\
Constant            &                     &     0.00895\sym{***}\\
                &                     &     (0.010)         \\
\midrule
b14                 &                     &                     \\
Constant            &                     &     0.00618\sym{**} \\
                &                     &     (0.027)         \\
\midrule
\(R^{2}\)           &       0.051         &       0.055         \\
Adjusted \(R^{2}\)  &       0.041         &       0.044         \\
F                   &       5.178         &                     \\
Observations        &        1207         &        1207         \\
\bottomrule
\multicolumn{3}{l}{\footnotesize \textit{p}-values in parentheses}\\
\multicolumn{3}{l}{\footnotesize \sym{*} \(p<0.1\), \sym{**} \(p<0.05\), 
\sym{***} \(p<0.01\)}\\
\end{tabular}
\end{table}

\end{document}

The following is the error message I get:

("C:\Users\Ruben\AppData\Local\Programs\MiKTeX 
2.9\tex\latex\booktabs\booktabs.
sty")
No file Strict_Indep_3d_95.aux.
! Undefined control sequence.
<argument> ...egressions Strictly Independent\tab 
                                              {tab1}}}{\thepage }}
l.9 ...Regressions Strictly Independent\tab{tab1}}

?

Can somebody help me please?

Remember, I am totally unexperienced with LaTeX/TeXworks/... I am just a guys who would like to have nice regression tables in his master's thesis.

  • \tab is not a defined command. I would guess that you intended \label – David Carlisle May 5 '18 at 10:19
  • 1
    if the \tab part is being generated, stick \newcommand\tab[1]{\label{#1}} before \begin{document} to define \tab to be \label – David Carlisle May 5 '18 at 10:20
5

If the \tab (which is not a command defined in any standard package as far as I know) part is being generated, stick

 \newcommand\tab[1]{\label{#1}}

before \begin{document} to define \tab to be \label.

Note however the latex generator you are using would not have generated \tab by accident it possibly is intended to be used with a custom package that defines the commands it uses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.