DXC
DXC

Reputation: 75

using esttab: how to specify number of digits for summary statitics

I am using estpost and esttab to produce a table of summary statistics. But I don't know how to specify the number of digits after the decimal points.

estpost summarize beauty bmi whr weight height armlength urban age sleep2014 if gender == 1 & year == 2014
est sto m1

estpost summarize beauty bmi whr weight height armlength urban age sleep2014 if gender == 0 & year == 2014
est sto m2

estpost summarize beauty bmi whr weight height armlength urban age if gender == 1 & year == 2012
est sto m3

estpost summarize beauty bmi whr weight height armlength urban age if gender == 0 & year == 2012
est sto m4

esttab m1 m2 m3 m4 using summary.tex, cells("mean sd min max") title(Summary statistics) replace

I tried cells("mean(3) sd(3) min(2) max(2)"), but it doesn't work. I read through all the examples in http://repec.org/bocode/e/estout/estpost.html. All the examples just leave the number of digits as they are originally for summary statistics. It is clearly stated how to do for regression results, but I haven't found anything useful for summary statistics.

Upvotes: 0

Views: 3819

Answers (1)

Eric HB
Eric HB

Reputation: 887

Here is an example for you:

sysuse auto
estpost summarize mpg price
esttab . using summary.tex, title("summary stats") ///
    cells(mean(fmt(%5.3f)) sd(fmt(%5.3f)) min(fmt(%5.2f)) max(fmt(%5.2f))) 

the important part is that you're using stat(fmt(format)) in the cells option. To find this I used the help estout documentation rather than help esttab

Upvotes: 3

Related Questions