1

I have a matrix of values (very non-standard summary statistics) that I want to pass from Stata to LaTeX. The command:

esttab matrix(matname) using $myfilename.tex, replace booktabs f

gives the matrix in LaTeX form but also gives the title of the matrix within the fragment. The same is true for:

outtable using myfilename, mat(matname) replace nobox

Currently, every time I rerun my Stata do file I have to go and edit myfilename.tex by hand.

Is there any way to non-manually remove the matrix name from the Stata to LaTeX output?

I tried using the option noheader, which works here:

matrix list matname, noheader 

but doesn't seem to be active in esttab or outtable. It also occurred to me that if I could find a way to ask LaTex to just \input PART of the fragment file (lines 2 onward) that would work...

1 Answer 1

3

I think the nomtitles option will work. Here's reproducible example:

sysuse auto
reg price trunk headroom
matrix myMat = e(V)

esttab matrix(myMat) using temp.tex, replace booktabs f nomtitles

This produces the text (.tex) file below:

            &       trunk&    headroom&       \_cons\\
\midrule
trunk       &    10557.96&   -35339.31&   -39464.18\\
headroom    &   -35339.31&    269901.5&   -321726.7\\
\_cons      &   -39464.18&   -321726.7&     1612951\\

Also, I used the following outtable command

outtable using "./temp", mat(myMat) replace center f(%9.2f) nobox

to produce this output:

% matrix: myMat file: ./temp.tex  10 Jun 2016 12:55:35
\begin{table}[htbp]
\begin{tabular}{lccc} \hline \hline
 & trunk  & headroom  & cons  \\  \hline 
trunk &  10557.96 \\  
headroom & -35339.31 & 269901.52 \\  
cons & -39464.18 & -3.22e+05 &  1.61e+06 \\  
\hline \hline \end{tabular}
\end{table}

While the matrix name is present in the output, it is commented out and so will not appear in the latex document.

1
  • Thanks so much, it works! I wasn't thinking of it as a model title.
    – Danielle
    Jun 10, 2016 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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