Announcement

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

  • Est tab - labeling categorical variables

    I have a categorical variable that I want to include in a table. I read about using refcat (http://repec.org/bocode/e/estout/hlp_estout.html#refcat) but am not sure why I am running into issues with using it for categorical variables.

    Race is coded as white, black, other (0, 1, 2). How can I get the last line to work to list "race" with "black" and "other" indented in lines beneath it?


    Code:
    webuse lbw, clear  
    logit low i.race  
    est store m1
    logit low i.race age 
    est store m2
    esttab m1 m2, refcat(age "Age") wide label  // this line works even though age is continuous 
    esttab m1 m2, refcat(race "Race") wide label // this line does not create label

    Thank you!

  • #2
    estout is from SSC (FAQ Advice #12). You need to reference a level of the categorical variable, not the categorical variable itself. "Black" is 2.race in the Hosmer & Lemeshow birth weight dataset.

    Code:
    webuse lbw, clear
    logit low i.race
    est store m1
    logit low i.race age
    est store m2
    esttab m1 m2, refcat(2.race "Race") nobaselevels wide label substitute("ref." "   ") eqlab(none)
    Res.:

    Code:
    . esttab m1 m2, refcat(2.race "Race") nobaselevels wide label substitute("ref." "   ") eqlab(none)
    
    ------------------------------------------------------------------------------
                                  (1)                          (2)                
                         Birthw~2500g                 Birthw~2500g                
    ------------------------------------------------------------------------------
    Race                                                                        
    Black                       0.845          (1.82)        0.745          (1.58)
    Other                       0.636          (1.83)        0.570          (1.62)
    Age of mother                                          -0.0395         (-1.22)
    Constant                   -1.155***      (-4.83)       -0.208         (-0.26)
    ------------------------------------------------------------------------------
    Observations                  189                          189                
    ------------------------------------------------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      Thank you, Andrew. This was very helpful!

      Comment

      Working...
      X