使用社区贡献的命令esttab
考虑以下玩具示例:
sysuse auto, clear
estpost tabstat mpg price, statistics(count mean) columns(statistics) listwise
esttab . , title("summary stats") cells("count(fmt(%5.0f)) mean(fmt(%5.0f))")
summary stats
--------------------------------------
(1)
count mean
--------------------------------------
mpg 74 21
price 74 6165
--------------------------------------
如何将列名从count
更改为N
?
答案 0 :(得分:1)
使用collabels()
选项:
sysuse auto, clear
estpost tabstat mpg price, statistics(count mean) columns(statistics) listwise
esttab . , title("summary stats") collabels("N" "Mean") ///
cells("count(fmt(%5.0f)) mean(fmt(%5.0f))")
summary stats
--------------------------------------
(1)
N Mean
--------------------------------------
mpg 74 21
price 74 6165
--------------------------------------
N 74
--------------------------------------