结合esttab和许多estpost

时间:2018-07-05 01:32:33

标签: stata

我的数据集中有四个假人。

如何在单个输出中加入不同的esttab结果?

因为我计划添加更多的虚拟对象,这对我真的很有帮助。

当前我有这个,必须在excel上将其合并:

quietly estpost sum HDI ECI GI TX GS BF LF MF TF IF FF
esttab, cell((count mean Var sd)) nonumber nomtitle title("Estatísticas Discritivas")

quietly estpost sum HDI ECI GI TX GS BF LF MF TF IF FF if HI==1
esttab, cell((count mean Var sd)) nonumber nomtitle title("Estatísticas Discritivas")

quietly estpost sum HDI ECI GI TX GS BF LF MF TF IF FF if UMI==1
esttab, cell((count mean Var sd)) nonumber nomtitle title("Estatísticas Discritivas")

quietly estpost sum HDI ECI GI TX GS BF LF MF TF IF FF if LMI==1
esttab, cell((count mean Var sd)) nonumber nomtitle title("Estatísticas Discritivas")

quietly estpost sum HDI ECI GI TX GS BF LF MF TF IF FF if LI==1
esttab, cell((count mean Var sd)) nonumber nomtitle title("Estatísticas Discritivas")

1 个答案:

答案 0 :(得分:2)

您只需要使用eststo存储单个结果:

sysuse auto, clear

estpost sum mpg price weight
eststo m1

estpost sum mpg price weight if foreign == 0
eststo m2

estpost sum mpg price weight if foreign == 1
eststo m3

垂直显示:

esttab m1 m2 m3, cell(count mean Var sd) nonumber nomtitle title("Custom Title")

Custom Title
---------------------------------------------------
             count/mean~d count/mean~d count/mean~d
---------------------------------------------------
mpg                    74           52           22
                  21.2973     19.82692     24.77273
                 33.47205     22.49887     43.70779
                 5.785503     4.743297     6.611187
price                  74           52           22
                 6165.257     6072.423     6384.682
                  8699526      9592055      6874439
                 2949.496     3097.104     2621.915
weight                 74           52           22
                 3019.459     3317.115     2315.909
                 604029.8     483530.7       187492
                 777.1936     695.3637     433.0035
---------------------------------------------------
N                      74           52           22
---------------------------------------------------

水平显示:

esttab m1 m2 m3, cell((count mean Var sd)) nonumber nomtitle title("Custom Title")

Custom Title
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                    count         mean          Var           sd        count         mean          Var           sd        count         mean          Var           sd
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mpg                    74      21.2973     33.47205     5.785503           52     19.82692     22.49887     4.743297           22     24.77273     43.70779     6.611187
price                  74     6165.257      8699526     2949.496           52     6072.423      9592055     3097.104           22     6384.682      6874439     2621.915
weight                 74     3019.459     604029.8     777.1936           52     3317.115     483530.7     695.3637           22     2315.909       187492     433.0035
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
N                      74                                                  52                                                  22                                       
------------------------------------------------------------------------------------------------------------------------------------------------------------------------