Estout

March 25, 2009 at 11:10 am 8 comments

| Gabriel |

There have been a lot of updates lately to the completely indispensable estout package.

If you’re thinking, what is this “estout” of which he speaks? Don’t walk, but run to your copy of Stata and type:

ssc install estout

If you already have estout and are trying to install the update try.

ssc install estout, replace

As every quant knows, getting Stata output into journal layout is really, really, tedious and you have to start all over and do it from scratch anytime you change anything about a model. When I was an undergrad I thought I was so cool when I realized I could read a log file into Excel as a fixed-width text file. This and some related tricks cuts down the time it takes to make a decent-sized regression table from about 40 minutes to about twenty minutes, but that’s still a pretty tedious 20 minutes.

So I was pretty happy when I learned about the various table-making commands that can do this for you. The first time somebody showed me how estout works I felt like one of the Munchkins after Dorothy killed the wicked witch of the East.

Estout cuts down table-making to between zero and five minutes, depending on how gung ho you are about tweaking the syntax. Really hardcore people have it output TeX that they embed directly in their write-up. The syntax is a little hard to learn but you generally only have to learn enough syntax to get it to work with one or two styles that you use often. Here’s my syntax to create an ASA-style table for a multi-level model with nested independent variables. I use it as fixed width because it makes it easier to import into a spreadsheet. (Excel really likes to think of parentheses as meaning “negative” rather than as literal strings).

eststo clear
eststo: xtreg y x1, re i(clusterid)
eststo: xtreg y x1 x2, re i(clusterid)
eststo: xtreg y x1 x2 x3, re i(clusterid)
esttab using table.txt , se b(3) se(3) scalars(ll rho) nodepvars nomtitles  label title(Table: REGRESSION MODELS OF SOMETHING) replace fixed

Entry filed under: Uncategorized. Tags: , .

Mansfield True Tales of the IMDB!

8 Comments

  • 1. mike3550  |  March 25, 2009 at 11:48 am

    I shudder to think of the time spent and mistakes made copying and pasting numbers from Stata log files before I figured out how to use the estout command.

    And, I think that the assumption that Excel makes that anything in parentheses is a negative number is quite possibly the most annoying quirk of a program full of annoying quirks.

  • 2. Martín Moreno  |  March 26, 2009 at 2:34 pm

    Maybe not a big tip, but to avoid the Excel problem of converting parentheses-delimited data into negativenumbers you can always change each column of data to a text type. Of course, it is problematic if you want to use the figures in the table as numbers.

  • 3. Bobby Chen  |  March 26, 2009 at 8:13 pm

    Hi Gabriel: Nice website. Keep it up!

    I’ve been trying to get tables with estout for awhile and I do agree that it is much much faster than cutting and pasting into Excel format. It does give me a lot of trouble, however, whenever I use to covert it into eform (i.e. Odds ratio with logistic regression or Incidence Rate ratio with negative binomial models). Moreover, the default star setting doesn’t include the .10 significance level mark, which I find annoying.

    • 4. gabrielrossman  |  March 26, 2009 at 9:07 pm

      Yeah, this is partly what I meant by saying it cuts it down to “0-5 minutes” instead of the more ambitious claim of “it does it for you.” Some things are impossible to specify (or it’s possible to specify but the syntax is too hard to learn for the likes of you and me) so each time you do it there’s some manual editing involved. Nonetheless it does cut down the time considerably. I generally try to follow the 90/10 rule for programming. If learning the syntax half-ass takes twenty minutes and involves a little manual tweaking every time then it might not be worth it to spend hours and hours learning the syntax properly.
      I noticed something about spost integration on the estout webpage, maybe that would help with the kind of models you’re using. (Myself, I don’t use spost very much because it’s not compatible with the xt syntax and I prefer the raw form of logit and nbreg coefficents anyway).

  • […] 14, 2009 | Gabriel | As mentioned before, I love estout. However I dislike some of its features, such as that it leaves a blank line between rows. I wrote […]

  • 6. Witness  |  January 4, 2013 at 8:02 am

    Hi Gabriel,

    Can you please assist me. I have tried and failed several times to install – estout/esttab, outreg2 on my machine. I am using Stata 11. I tried the following;
    – findit estout
    – findit estta
    – findit outreg2
    – ssc install estout

    It gives me this failure message;

    . ssc install estout
    connection timed out — see help r(2) for troubleshooting
    http://fmwww.bc.edu/repec/bocode/e/ either
    1) is not a valid URL, or
    2) could not be contacted, or
    3) is not a Stata download site (has no stata.toc file).

    Thank you for your assistance

    • 7. gabrielrossman  |  January 4, 2013 at 10:34 am

      just tested it and “ssc install estout” works for me. i suggest trying again and seeing if it works. good luck

    • 8. Nick Cox  |  January 7, 2013 at 11:07 am

      This problem may arise because your Stata is not set up to download files over the internet. See -help netio-, especially the first three commands. You may need help from your local IT experts.


The Culture Geeks


%d bloggers like this: