Intro to Outreg

 [Important Update: The Outreg module is no longer maintained. The preferred alternative is Estout, which is more powerful and includes the ability to export to, inter alia, HTML and LaTeX. The documentation is extensive, but when I've worked with the module for a while, I'll do a tutorial. Hat tip to Andy Felton for filling me in.]

[Update to the update: Chris Ruebeck points me to outreg2, an updated version of the original module. It looks like Stata users have numerous ways to streamline their output-to-paper process.]

The Outreg module for Stata makes it easy to save output from statistical procedures in separate tab-delimited text files, which are easy to use with other applications. Outreg is an extremely useful add-in.

Setup
To get Outreg, visit the link above and download outreg.ado and outreg.hlp. Place the files in the “O” folder of your Stata updates directory. If you’re using OS X, that directory is located in

/Applications/Stata/ado/updates/o

If you’re using Windows, the directory is located in

C:\Program Files\Stata\ado\updates\o [*]

Now you’re ready to use the module.

Outputting a table
Outreg is used after an estimation command. For example, after the regression

regress x y

the command

outreg using my_output.txt

would create a new textfile named “my_output.txt” containing a journal-style regression table (variable names and parameter values in columns, variables in rows, standard-errors beneath coefficient estimates).

If you then formulated a second regression

regress x y z

the command

outreg using my_output.txt , append

would add the estimates from the second regression to the table. Alternatively, if you wanted to completely replace the text file, you could use

outreg using my_output.txt, replace

Options
Outreg has many options, all of which are documented in detail in the outreg.hlp file, which can be browsed by typing help outreg in the command line. One useful option is pval, which replaces standard errors with p-values in the tables produced. To invoke this option, use

outreg using my_output.txt , pval

Uses
The tab-delimited text format is useful because it is compatible with so many other applications. For example:

  • Tab-delimited text files can be imported directly into Excel, Calc or other spreadsheet applications. From there, they can be used for further calculations, or prepared to be copied into a word processor
  • By copying the contents of the text file and copying it into your word processor and using its text to table conversion feature[**], you can quickly create styled tables
  • The tab-delimited text can be easily converted to the LaTeX table format using, for example, my Tableizer AppleScript with TextWrangler

[*] These may differ, depending on your exact setup.
[**] In OpenOffice or NeoOffice: Select the text and go to Tools: Text <-> Table and select “Tabs” as the delimiter. In Word: Select the text and go to Table: Convert: Convert Text to Table, and use “separate text at tabs”


  • Quick navigation

  • Categories