Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to export regression tables generated with "foreach

    Hello,

    I was trying to export a table to word using the esttab and outreg2 command that I am familiar with. Every time I tried it the exported table only contained the last of three columns

    The regression code I used is the following:


    Code:
    foreach grp in n i o {
    quietly regress lrgdpw85 lsav lpop if `grp'
    estimates store est`grp'
    }
    
    esttab estn esti esto, b(%9.2f) se(%9.2f) r2(%9.2f) ///
    title("Unrestricted regressions")
    estimates clear
    eststo clear
    The codes I used were

    outreg2 using results.rtf, append ///(or replace) and
    esttab

    Which code do I have to use to export the entire three columns to a word file

    Click image for larger version

Name:	Bildschirmfoto 2021-12-19 um 19.38.22.png
Views:	2
Size:	239.8 KB
ID:	1641559
    Attached Files
    Last edited by Fa Anaira; 19 Dec 2021, 13:06.

  • #2
    Perhaps this example will point you in a useful direction.
    Code:
    sysuse auto, clear
    forvalues o=0/1 {
    quietly regress price weight if foreign==`o'
    estimates store est`o'
    }
    
    esttab est0 est1 using results.rtf, replace b(%9.2f) se(%9.2f) r2(%9.2f) ///
    title("some regressions")
    When I open results.rtf in Microsoft Word I see this table.

    Click image for larger version

Name:	table.png
Views:	1
Size:	68.1 KB
ID:	1641578

    Comment

    Working...
    X