Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Stata Estimates to LaTeX Tables

From   Fredrik Wallenberg <>
Subject   st: Stata Estimates to LaTeX Tables
Date   Mon, 10 May 2004 17:23:52 -0700

I assume there are many users on this list that regularly convert Stata estimates into LaTeX tables and wanted to get some input from you...

There are a number of solutions available to get a stata regression output into LaTeX. If you only want one single regression, outtex provides a nicely formatted, if somewhat old, LaTeX code with sufficient features for most users. However, I almost exclusively report multiple versions/models which means I want to report them in multiple columns, one model per column. There are, to the best of my knowledge, two ways to do that. For the direct stata to LaTeX route there is the est2vec+est2tex package. The other option is to use outreg to get the output into Excel (actually it is only a tab separated text file) and then use the Excel2TeX macro to output into LaTeX.

While est2vec/tex is the best route as far as being direct, it lacks certain features that makes it less useful (and/or adds significant post-processing anyway).

My goal is to extend est2vec and est2tex to provide (myself with) a better solution. Before I get started I wanted to see if I could get some input on this (and maybe even some help :-)

If I get enough people to show interest I would consider setting up a sourceforge project for this... if anyone has experience with that, let me know.

Est2Vec (storing the relevant information in matrices for later export to Latex)

Exponential Output
One limitation I've found here so far is the ability to report exponential forms of the estimates and standard deviations. Lifting code from -outreg- I have already added the option -eform- to -est2vec- and it seems to be working (but needs more testing).

Manual Variables
I find that I frequently want to report a table with several control variables (such as state dummies) suppressed). I am considering allowing the user to add one (or more) lines to the end of the variable lists. For example EXTRAVAR(State Dummies)(yes) would add a new variable named "State Dummies" with a value "yes" to the coefficient matrix (and probably an empty observation in the errors matrix).

Is there anything else missing??

Est2Tex (create and save LaTeX files from information stored in matrices by -est2vec-)

Significance Marks
My first goal here is to allow the use of "fancy" significance marks. Both -est2tex- and -outreg- simply use *, **, *** (or +,*,**). -Outtex- however defines \onepc, \fivepc and \tenpc for a much more elegant output. Further, -outtex- also (depending on options) puts the estimates and the significance in separate columns (r @{} l). There are two ways to implement the latter, one is using the same approach as -outtex-, the other is to use the package -dcolumns-. The latter would be nicer if I could get it to work (so far it doesn't like macros in the columns and I might have to use the -outtex- approach). An extension would be to suppress the definition of the significance terms (\onepc etc) in each table and rely on those being defined in the header of the document. A similar flag would probably be added for -dcolumn- column types (if I decide to use -dcolumn-). Implementation through a new FANCY2 option (or something like that).

Standard Error formatting
-Est2tex- currently does not allow me to put standard errors within brackets (rather than parenthesis) or include them without a parenthesis. The former is an option for -outreg- and the latter is an option for -outtex- but I don't know if it should be a priority... let me know if this is important to include. Implementation options: NOPAR BRACKET

Long table
-Outtex- allows the use of the -longtable- package and I find that a necessity for many of my long regression results. This would be implemented with LONG_TABLE option.

-Est2tex- produces -tabular- output that the user then has to put into a -table- wrapper should (s)he want a float and/or want a caption and label for the table. I am considering adding a TA_BLE option that would also be assumed if the user adds either CAP_TION() or LA_BEL()

I just learned about the package -booktabs- that makes the table conform closer to predominant publishing standards. I would consider enabling it as part of the FANCY2 option.

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index