Search code examples
statisticsstatasummary

Changing summary statistics terms in esttab


I am using the following code:

estpost summarize gdpgrowth, listwise
esttab, cells("mean sd  min max") nomtitle number

The idea is to create a summary statistics table of the variable gdpgrowth using esttab.

I get this output:

enter image description here

I like everything about this except I would want to take away the (1) from the mean name, turn sd to standard deviation, turn min into minimum and max into maximum.

I would also like to round off each number to the second decimal and change N to sample size.


Solution

  • The following works for me:

    sysuse auto, clear
    
    eststo clear
    estpost summarize price
    
    esttab, cells("mean(fmt(%8.2f)) sd(fmt(%8.2f)) min(fmt(%8.2f)) max(fmt(%8.2f))") ///
    stats(N, fmt(%5.0f) labels("Sample size")) nonumbers wide ///
    collabels("Mean" "Std. Dev." "Minimum" "Maximum")
    
    ----------------------------------------------------------------
    
                         Mean    Std. Dev.      Minimum      Maximum
    ----------------------------------------------------------------
    price             6165.26      2949.50      3291.00     15906.00
    ----------------------------------------------------------------
    Sample size            74                                       
    ----------------------------------------------------------------