Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: RE: Create a table of estimation results from several simple regressions

 From Lance Erickson To "statalist@hsphsun2.harvard.edu" Subject st: RE: RE: Create a table of estimation results from several simple regressions Date Tue, 29 May 2012 22:53:59 +0000

```Hassan,

When I have problems like this I take advantage of the results Stata saves after a model and put the information I need into a matrix. The help file for -esttab- suggests it can tabulate matrices. So you might do something like this...

sysuse auto, clear

reg price mpg
matrix mpg = r(table)'
matrix mpg = mpg[1,1..2],e(N)

reg price rep78
matrix rep78 = r(table)'
matrix rep78 = rep78[1,1..2],e(N)

reg price turn
matrix turn = r(table)'
matrix turn = turn[1,1..2],e(N)

matrix table = mpg\rep78\turn

matrix colnames table = b se N

esttab matrix(table)

Of course, you can modify the output table as described in the -esttab- help file (Ben Jann from SSC) but this should give you the basic structure you're looking for. (Although not necessary, looping through the independent variables would be more efficient and wouldn't be too difficult if you're familiar with using -foreach-.)

Best,
Lance
________________________________________
Sent: Tuesday, May 29, 2012 11:49 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Create a table of estimation results from several simple regressions

Hassan,

You might find it easiest to create your own (pipe- or comma- or
tab-delimited) text file using the -file- command. This will require a
little programming but will give you much more flexibility. See, for
example:

http://www.stata.com/statalist/archive/2008-02/msg00362.html

David
--
Senior Research Associate
MPR Associates, Inc.
2150 Shattuck Ave., Suite 800
Berkeley, CA 94704
Phone: 510-849-4942
Fax: 510-849-0794

www.mprinc.com

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Hassan Enayati
> Sent: Tuesday, May 29, 2012 10:17 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Create a table of estimation results from several simple
> regressions
>
> Hello all,
>
> I need to create a table of estimation results, including estimates,
> standard errors, and number of observations, from several simple
> regressions. The finished table should have the following structure:
>
> Model 1 | Estimate | Std. Error | Num. Obs.
> Model 2 | Estimate | Std. Error | Num. Obs.
> Model 3 | Estimate | Std. Error | Num. Obs.
>
> At first, I used eststo and then esttab. Unfortunately, I can not get
> the esttab output to take the above specified form. The problem with
> esttab is that even under the wide option, it tabs over for each
> model. Additionally, esttab won't place the number of observations as
> the last entry on a given row. The result looks like the following:
>
> M1 | Est | SE |
>  Number of Obs
>                   M2 | Est | SE | #
>                    Number of Obs
>                                     M3 | Est | SE | #
>                                      Number of Obs
>
> How can I produce a table that looks like the first structure I showed
> above? Thanks in advance for the help.
>
> --
> Hassan

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```