Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: outreg: merging results from several regressions

 From "Peter Neumayr" To statalist@hsphsun2.harvard.edu Subject Re: st: outreg: merging results from several regressions Date Sun, 03 Feb 2013 20:41:10 +0100

```Thanks John!

First this didn't work for me, so I played around until I found out that installing -frmttable-
(which includes a newer version of outreg?) solves my problems.
Now everything is fine, the code you suggested does exactly what I want

peter

----- Ursprüngliche Nachricht -----
Von: John Luke Gallup
Gesendet: 02.02.13 23:11 Uhr
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: outreg: merging results from several regressions

Peter,

The following code should do what you want:

sysuse auto, clear
qui reg price length
outreg, keep(length) se noautosum ctitle("", (1)) rtitle("row1") nod
qui ivreg price (length=weight)
outreg, merge keep(length) se noautosum ctitle("", (2)) rtitle("row1")
qui reg price length rep78
outreg, clear(r2)
outreg, store(r2) keep(length) se noautosum rtitle("row2") nod
qui ivreg price (length=weight) rep78
outreg, merge(r2) keep(length) se noautosum rtitle("row2")
outreg, replay append(r2)

The difficulty is that the -merge- and -append- options always create a new column or a new row, respectively. There is no way to use them to fill in the (2,2) cell unless you create two tables separately and join them together. The table above holding the first row is unnamed, and the -outreg, replay- command appends the table named "r2" with the second row.

Alternatively, you could have created a table for each column (using the -append- option) and used -outreg, replay- to merge them together.

John

On Feb 2, 2013, at 2:05 AM, "Peter Neumayr" <peter.neumayr@gmx.at> wrote:

> Hi!
>
> I'm new to outreg. My task seems quite simple but i can't figure out how to do it.
> I try to produce a table where each column represent a model (e.g. OLS and IV) and each rows should present results from different regressions.
>
> That means each table cell should contain a result from a specific regression.
>
> The best I got so far is:
> --------------------------------
> (1) (2)
> --------------------------------
> row1 57.202 75.419
> (14.080)** (15.056)**
> row2 65.463
> (14.851)**
> row2 87.716
> (16.065)**
> --------------------------------
> * p<0.05; ** p<0.01
>
> but what I want is:
> --------------------------------
> (1) (2)
> --------------------------------
> row1 57.202 75.419
> (14.080)** (15.056)**
> row2 65.463 87.716
> (14.851)** (16.065)**
> --------------------------------
> * p<0.05; ** p<0.01
>
> I've used this code:
>
> clear
> sysuse auto
> outreg, clear(t1)
> qui reg price length
> outreg, merge(t1) keep(length) se noautosum ctitle("", (1)) rtitle("row1") nod
> qui reg price length rep78
> outreg, append(t1) keep(length) se noautosum ctitle("", (1)) rtitle("row2") nod
> qui ivreg price (length=weight)
> outreg, merge(t1) keep(length) se noautosum ctitle("", (2)) rtitle("row1")
> qui ivreg price (length=weight) rep78
> outreg, append(t1) keep(length) se noautosum ctitle("", (2)) rtitle("row2")
>
> Hoping for help!
> Thanks a lot!
> peter
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```