重命名esttab中的列

时间:2019-04-17 12:09:20

标签: stata

使用社区贡献的命令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

1 个答案:

答案 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             
--------------------------------------