Announcement

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

  • Transform elements in Esttab

    Dear Statalisters,

    I am trying to automate the process of creating a descriptive statistics table by using 'esttab' in Stata 14.0. Data is longitudinal and consists of 12 waves. All goes well in principle, but I would like to report the percentages as a number between 0-100%, not as a number between 0-1. I have tried using the option 'transform' for 'esttab' but I can't seem to figure it out.

    For instance; the variables HHHP, HHHF and HHHR are dummy variables. So taking the mean results in a number between 0-1. I would like to 'multiply this number by a 100' to get the percentage of observations that are equal to 1.

    Code:
     
    quietly eststo A: estpost sum HHHP HHHF HHHR
    quietly eststo B: estpost sum HHHP HHHF HHHR if year == 1
    quietly eststo C: estpost sum HHHP HHHF HHHR if year == 12
    
    #delimit;
    esttab A B C, replace
    mtitle("All waves" "Wave 1" "Wave 12")
    cells(mean(fmt(2))) label nonum f collabels(none) noobs
    transform(100*@ @)
    ;
    #delimit cr
    I would really appreciate any help on this topic, thank you very much in advance!

    Greetings,
    Rinze

  • #2
    I don't think transform works on matrices other than b and se, so it's not getting applied to arbitrary matrices like mean from estpost. I suggest using estadd.

    quietly eststo A: estpost sum HHHP HHHF HHHR
    estadd matrix pc = e(mean)*100
    esttab A, cells(pc(fmt(2)))

    Comment

    Working...
    X