我正在尝试使用Stata中的estout
按子组创建摘要统计信息表。我的努力已经取消the official estout online documentation。
我希望每个子组的计数出现在最终表中。我知道最后一行中的noobs
删除了观察计数。但是,如果我包含noobs
,则仅包括总观察计数,而不包括各个子组的计数。
例如:
. sysuse auto
(1978 Automobile Data)
. estpost tabstat price mpg rep78, by(foreign) statistics(mean sd) ///
columns(statistics) listwise
Summary statistics: mean sd
for variables: price mpg rep78
by categories of: foreign
foreign | e(mean) e(sd)
-------------+----------------------
Domestic |
price | 6179.25 3188.969
mpg | 19.54167 4.753312
rep78 | 3.020833 .837666
-------------+----------------------
Foreign |
price | 6070.143 2220.984
mpg | 25.28571 6.309856
rep78 | 4.285714 .7171372
-------------+----------------------
Total |
price | 6146.043 2912.44
mpg | 21.28986 5.866408
rep78 | 3.405797 .9899323
. esttab, main(mean) aux(sd) nostar unstack noobs nonote nomtitle nonumber
---------------------------------------------------
Domestic Foreign Total
---------------------------------------------------
price 6179.2 6070.1 6146.0
(3189.0) (2221.0) (2912.4)
mpg 19.54 25.29 21.29
(4.753) (6.310) (5.866)
rep78 3.021 4.286 3.406
(0.838) (0.717) (0.990)
---------------------------------------------------
答案 0 :(得分:2)
以下是您要找的内容:
clear
sysuse auto
by foreign: eststo: estpost summarize price mpg rep78, listwise
eststo Total: estpost summarize price mpg rep78, listwise
esttab, main(mean) aux(sd) nostar nonote label nonumber nodepvar
-----------------------------------------------------------
Domestic Foreign Total
-----------------------------------------------------------
Price 6179.2 6070.1 6146.0
(3189.0) (2221.0) (2912.4)
Mileage (mpg) 19.54 25.29 21.29
(4.753) (6.310) (5.866)
Repair Record 1978 3.021 4.286 3.406
(0.838) (0.717) (0.990)
-----------------------------------------------------------
Observations 48 21 69
-----------------------------------------------------------