Announcement

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

  • help with -esttab- (how to show variable names in tex output)

    Hello,
    I am using esttab to export some summary statistics table to latex but I cannot figure out to how to get the tex output to contain variable names. I can see only variable labels but not the variable names. Can someone please advise how to get the variable names to show in the tex output?

    Currently it looks like this:
    mean sd min max
    from 12 to 15 y.o. 0,33 ... 0 1
    from 16 to 21 y.o. 0,33 ... 0 1
    from 22 to 30 y.o. 0,33 ... 0 1
    female 0,48 ... 0 1
    male 0,52 ...

    and i want it to look like this:
    mean sd min max
    Age
    from 12 to 15 y.o. 0,33 ... 0 1
    from 16 to 21 y.o. 0,33 ... 0 1
    from 22 to 30 y.o. 0,33 ... 0 1
    Gender
    female 0,48 ... 0 1
    male 0,52 ...

    My current code is:

    eststo test1: proportion Age Gender [pw=weight]
    estadd summ

    esttab test1 using test1, tex cells("mean(fmt(2)) sd(fmt(2)) min(fmt(0)) max(fmt(0))") ///
    replace title({\b Table 1.}Summary statistics) nonumbers mtitles(" ") ///
    addnote(Note: All figures are weighted.)


    Thank you in advance for your time!







  • #2
    estout is from SSC (FAQ Advice #12). See the -refcat- option in

    Code:
    help estout
    Code:
    sysuse auto, clear
    regress mpg weight i.rep78 turn i.foreign, robust
    *PLACE LABEL/ VARNAME ABOVE FIRST DISPLAYED COEFFICIENT (HIGHLIGHTED)
    esttab,  refcat(2.rep78 "`:var lab rep78'" 1.foreign "`:var lab foreign'", nolabel) varwidth(20) nobaselevels
    Res.:

    Code:
    . esttab,  refcat(2.rep78 "`:var lab rep78'" 1.foreign "`:var lab foreign'", nolabel) varwidth(20) nobaselevels
    
    ------------------------------------
                                  (1)  
                                  mpg  
    ------------------------------------
    weight                   -0.00513***
                              (-5.41)  
    
    Repair record 1978                  
    
    2.rep78                     0.104  
                               (0.13)  
    
    3.rep78                    -0.195  
                              (-0.26)  
    
    4.rep78                     0.434  
                               (0.46)  
    
    5.rep78                     3.565  
                               (1.90)  
    
    turn                       -0.285  
                              (-1.73)  
    
    Car origin                          
    
    1.foreign                  -3.321**
                              (-3.07)  
    
    _cons                       48.60***
                               (9.91)  
    ------------------------------------
    N                              69  
    ------------------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      Thank you Andrew! It worked

      Comment

      Working...
      X