Search code examples
statisticsstata

How to export results from Stata to a scripting language?


I'm sure this is an issue anyone who uses Stata for publications or reports has run into:

How do you conveniently export your output to something that can be parsed by a scripting language or Excel?

There are a few ado files that do this for specific commands. For example:

  • findit tabout
  • findit outreg2

But what about exporting the output of the table command? Or the results of an anova?

How to address this problem for either specific commands or in general?


Solution

  • This is an old question and a lot has happened since it was posted.

    Stata now has several built-in commands and functions that allow anyone to export customized output fairly easily:

    There are also equivalent Mata functions / classes, which offer greater flexibility:

    From my experience, there aren't 100% general solutions. Community-contributed commands such as estout are now mature enough to handle most basic operations. That said, if you have something that deviates even slightly from the template you will have to program this yourself.