Announcement

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

  • Estout (excel) not exporting interaction terms

    Hello Statlist,
    I am using est sto and estout to export regression results to excel. I know it should be able to export interaction coefficient but in my case this is not working:


    PHP Code:
    sysuse auto
    (1978 automobile data)

    reg price rep78##c.mpg

          
    Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(959)        =      3.65
           Model 
    |   206362465         9  22929162.7   Prob F        =    0.0011
        Residual 
    |   370434494        59  6278550.75   R-squared       =    0.3578
    -------------+----------------------------------   Adj R-squared   =    0.2598
           Total 
    |   576796959        68  8482308.22   Root MSE        =    2505.7

    ------------------------------------------------------------------------------
           
    price Coefficient  Stderr.      t    P>|t|     [95confinterval]
    -------------+----------------------------------------------------------------
           
    rep78 |
              
    2  |   10881.12   13452.68     0.81   0.422    -16037.64    37799.87
              3  
    |   8973.281   12725.58     0.71   0.483    -16490.55    34437.11
              4  
    |   651.7399    12823.1     0.05   0.960    -25007.23    26310.71
              5  
    |   4363.191   12794.52     0.34   0.734    -21238.58    29964.96
                 
    |
             
    mpg |  -123.1667      590.6    -0.21   0.836    -1304.955    1058.621
                 
    |
     
    rep78#c.mpg |
              
    2  |  -507.6563   642.1123    -0.79   0.432     -1792.52    777.2075
              3  
    |  -375.7209   601.1921    -0.62   0.534    -1578.704    827.2618
              4  
    |   43.26329   603.3025     0.07   0.943    -1163.942    1250.469
              5  
    |  -81.52802     597.53    -0.14   0.892    -1277.183    1114.127
                 
    |
           
    _cons |       7151   12528.52     0.57   0.570    -17918.51    32220.51
    ------------------------------------------------------------------------------

    est sto ols1

    estout ols1cells(b(star fmt(%9.3f)) se(par fmt(%9.2f)) N)  keep(rep78#c.mpg) //
    coefficient rep78#c.mpg not found
    r(111); 

  • #2
    Perhaps this example will start you in a useful direction.
    Code:
    . sysuse auto
    (1978 automobile data)
    
    . reg price rep78##c.mpg
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(9, 59)        =      3.65
           Model |   206362465         9  22929162.7   Prob > F        =    0.0011
        Residual |   370434494        59  6278550.75   R-squared       =    0.3578
    -------------+----------------------------------   Adj R-squared   =    0.2598
           Total |   576796959        68  8482308.22   Root MSE        =    2505.7
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           rep78 |
              2  |   10881.12   13452.68     0.81   0.422    -16037.64    37799.87
              3  |   8973.281   12725.58     0.71   0.483    -16490.55    34437.11
              4  |   651.7399    12823.1     0.05   0.960    -25007.23    26310.71
              5  |   4363.191   12794.52     0.34   0.734    -21238.58    29964.96
                 |
             mpg |  -123.1667      590.6    -0.21   0.836    -1304.955    1058.621
                 |
     rep78#c.mpg |
              2  |  -507.6563   642.1123    -0.79   0.432     -1792.52    777.2075
              3  |  -375.7209   601.1921    -0.62   0.534    -1578.704    827.2618
              4  |   43.26329   603.3025     0.07   0.943    -1163.942    1250.469
              5  |  -81.52802     597.53    -0.14   0.892    -1277.183    1114.127
                 |
           _cons |       7151   12528.52     0.57   0.570    -17918.51    32220.51
    ------------------------------------------------------------------------------
    
    . // find out what the coefficient names are
    . reg, coeflegend
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(9, 59)        =      3.65
           Model |   206362465         9  22929162.7   Prob > F        =    0.0011
        Residual |   370434494        59  6278550.75   R-squared       =    0.3578
    -------------+----------------------------------   Adj R-squared   =    0.2598
           Total |   576796959        68  8482308.22   Root MSE        =    2505.7
    
    ------------------------------------------------------------------------------
           price | Coefficient  Legend
    -------------+----------------------------------------------------------------
           rep78 |
              2  |   10881.12  _b[2.rep78]
              3  |   8973.281  _b[3.rep78]
              4  |   651.7399  _b[4.rep78]
              5  |   4363.191  _b[5.rep78]
                 |
             mpg |  -123.1667  _b[mpg]
                 |
     rep78#c.mpg |
              2  |  -507.6563  _b[2.rep78#c.mpg]
              3  |  -375.7209  _b[3.rep78#c.mpg]
              4  |   43.26329  _b[4.rep78#c.mpg]
              5  |  -81.52802  _b[5.rep78#c.mpg]
                 |
           _cons |       7151  _b[_cons]
    ------------------------------------------------------------------------------
    
    . est sto ols1
    
    . // see help estout to see how to use wild cards for the keep and drop options
    . estout ols1, cells(b(star fmt(%9.3f)) se(par fmt(%9.2f)) N)  keep(?.rep78#c.mpg) //
    
    ----------------------------
                         ols1   
                       b/se/N   
    ----------------------------
    1.rep78#c.~g        0.000   
                          (.)   
                                
    2.rep78#c.~g     -507.656   
                     (642.11)   
                                
    3.rep78#c.~g     -375.721   
                     (601.19)   
                                
    4.rep78#c.~g       43.263   
                     (603.30)   
                                
    5.rep78#c.~g      -81.528   
                     (597.53)   
                                
    ----------------------------
    
    .

    Comment


    • #3
      Solved, thanks a lot!

      Comment

      Working...
      X