[OS X TeX] Stata Estimates to LaTeX tables

Fredrik Wallenberg fwallenberg at mac.com
Wed May 12 00:29:06 CEST 2004


You can certainly make it much much easier by using outreg to get the 
output into Excel and then use the excel2latex excel macro to produce 
the LaTeX code (it isn't perfect but it gives you a good start).

Fredrik


On May 10, 2004, at 18:49, Marcelo LaFleur wrote:

> Just wanted to chime in.  I use Stata and I've had to convert many 
> output
> tables to TeX.  I found that the easiest way to do that was to do a 
> "copy
> table" command from Stata and paste it into Excel. I added columns 
> with the
> "&" and "\\" commands, as well as general formatting. Then I copied the
> entire excel table into TextEdit as plain text or directly into 
> TeXShop.
>
> Kind of a roundabout way of doing things, but at least I didn't have to
> enter all the coefficients and other statistics by hand.
>
> It would be great to have a Stata module that did this, instead of a 
> TeX
> module.
>
>
> -- 
> Marcelo T. LaFleur, Ph.D.
>
>
>
> on 5/10/04 8:27 PM, Fredrik Wallenberg at fwallenberg at mac.com wrote:
>
>> 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. I
>> know I should send this to the "real" tex list, but wanted to start in
>> small scale :-)
>>
>> 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.
>>
>> Table
>> -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()
>>
>> Booktabs
>> 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.
>>
>>
>> -----------------------------------------------------
>> Please see <http://www.esm.psu.edu/mac-tex/> for list
>> guidelines, information, and LaTeX/TeX resources.
>>
>>
>
> -----------------------------------------------------
> Please see <http://www.esm.psu.edu/mac-tex/> for list
> guidelines, information, and LaTeX/TeX resources.
>
>

-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the macostex-archives mailing list