Reputation: 2405
I would like to produce a summary statistics table looking like the one below:
Female Male
p1
p10
p50
p99
However, with estpost
and esttab
, I can only produce a table like the following:
(1) (2)
p1/p10/p5~99 p1/p10/p5~99
-3.756124 -4.159476
1.009338 -1.210738
.3221763 .2945236
.8658271 .8658271
.9871135 .9871135
The code i am using is the following:
estpost summarize math_std if female == 1 , detail
eststo female
estpost summarize math_std if female == 0 , detail
eststo male
esttab female male , cells(p1 p10 p50 p95 p99) noobs
How can I put the column labels in the desired place?
Upvotes: 0
Views: 1488
Reputation:
Here's a solution relying on the creation of a matrix with the relevant results:
sysuse auto, clear
quietly summarize price if foreign == 1 , detail
matrix foreign = r(p1) \ r(p10) \ r(p50) \ r(p95) \ r(p99)
quietly summarize price if foreign == 0 , detail
matrix domestic = r(p1) \ r(p10) \ r(p50) \ r(p95) \ r(p99)
matrix both = foreign , domestic
matrix rownames both = p1 p10 p50 p95 p99
matrix colnames both = foreign domestic
esttab matrix(both), mlabels(none)
--------------------------------------
foreign domestic
--------------------------------------
p1 3748 3291
p10 3895 3955
p50 5759 4782.5
p95 11995 13594
p99 12990 15906
--------------------------------------
Upvotes: 1