Announcement

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

  • esttab: Inconsistent display of locals using the scalars() option

    Hello!

    I'm having some trouble getting esttab (from the estout package available on SSC) to display multiple custom text rows based on locals added with estadd local.

    I add two locals, weights and controls, to a stored estimation. However, when I try to display them using the scalars() option in esttab, only some appears in the final table.

    Here is a minimal working example using the auto dataset:

    Code:
    clear
    sysuse auto
    
    est clear
    eststo: reg price weight mpg
    estadd local weights "No"
    estadd local controls "Yes"
    
    esttab , ///
    b(%6.4f) se(%6.4f) star(* 0.1 ** 0.05 *** 0.01) sfmt(%6.2f) numbers ///
    scalars("weights Weights" "controls Controls" "N") nonotes

    This code produces a table that includes the row for 'Weights' but omits the one for 'Controls'. My goal is to have both 'Weights' and 'Controls' appear at the bottom of the table, similar to how 'N' is displayed.

    In this second example, only the local for Worker FE appears:

    Code:
    est clear
    eststo: reg price weight mpg
    estadd local WorkerFE "Yes"
    estadd local FirmFE "Yes"
    estadd local Controls "Yes"    
            
    esttab *, ///
    b(%6.4f) se(%6.4f) star(* 0.1 ** 0.05 *** 0.01) sfmt(%6.2f) numbers nomtitle ///
    scalars("Controls Controls" "WorkerFE Worker FE" "FirmFE Firm FE" "N" "r2 R squared")

    Could anyone point out what I am doing wrong here?

    I have used this approach multiple times, but for some reason, some times the added local appears in the tables as intended and sometimes it doesn't, and I have no idea why.

    Thank you very much in advance!
    Hélder

  • #2
    Originally posted by Helder Costa View Post
    This code produces a table that includes the row for 'Weights' but omits the one for 'Controls'.
    I cannot replicate this. Perhaps update estout and try again.

    Code:
    ssc install estout, replace
    Res.:

    Code:
    . eststo: reg price weight mpg
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(2, 71)        =     14.74
           Model |   186321280         2  93160639.9   Prob > F        =    0.0000
        Residual |   448744116        71  6320339.67   R-squared       =    0.2934
    -------------+----------------------------------   Adj R-squared   =    0.2735
           Total |   635065396        73  8699525.97   Root MSE        =      2514
    
    ------------------------------------------------------------------------------
           price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          weight |   1.746559   .6413538     2.72   0.008      .467736    3.025382
             mpg |  -49.51222   86.15604    -0.57   0.567    -221.3025     122.278
           _cons |   1946.069    3597.05     0.54   0.590    -5226.245    9118.382
    ------------------------------------------------------------------------------
    (est1 stored)
    
    . estadd local weights "No"
    
    added macro:
                e(weights) : "No"
    
    . estadd local controls "Yes"
    
    added macro:
               e(controls) : "Yes"
    
    .
    . esttab , ///
    > b(%6.4f) se(%6.4f) star(* 0.1 ** 0.05 *** 0.01) sfmt(%6.2f) numbers ///
    > scalars("weights Weights" "controls Controls" "N") nonotes
    
    ----------------------------
                          (1)  
                        price  
    ----------------------------
    weight             1.7466***
                     (0.6414)  
    
    mpg              -49.5122  
                    (86.1560)  
    
    _cons             1.9e+03  
                    (3.6e+03)  
    ----------------------------
    N                      74  
    Weights                No  
    Controls              Yes  
    ----------------------------
    
    .

    Comment


    • #3
      Yes, updating the command worked!
      Sorry, I should have thought of that.

      Thank you!

      Comment

      Working...
      X