如何在不使用 estadd 的情况下将文本添加到 esttab table 的底部

How to add text to bottom of esttab table without using estadd

下面的代码使用 local 向每个方程添加自定义文本并生成我想要的内容:

estimates clear
eststo clear
sysuse auto, clear

eststo w1: regress price mpg trunk length
estadd local number one
eststo w2: regress turn mpg trunk length
estadd local number two
eststo w3: regress displacement mpg trunk length
estadd local number three

esttab w1 w2 w3, stats(number)

但是,我希望能够在 esttab 命令语法中编写自定义文本,而不是在使用 locals 之前。

这是不正确的,但该选项可能如下所示:

estimates clear
eststo clear
sysuse auto, clear

eststo w1: regress price mpg trunk length
eststo w2: regress turn mpg trunk length
eststo w3: regress displacement mpg trunk length

esttab w1 w2 w3, stats("number", "one" "two" "three")

我能否以某种方式在 esttab 命令中插入一个选项来拼出我想要的内容?我知道有一个 indicate() 选项,但我不知道它是否可以满足我的需要。

遗憾的是,您无法即时定义 stats() 元素的内容。

但是,解决方法如下:

sysuse auto, clear
eststo clear
estimates clear

eststo w1: regress price mpg trunk length
eststo w2: regress turn mpg trunk length
eststo w3: regress displacement mpg trunk length

esttab, prefoot(`"{hline 60}"' ///
                `"numbers{dup 15: }one{dup 13: }two{dup 11: }three"' ///
                `"more numbers{dup 9: }four{dup 12: }five{dup 13: }six"') 

------------------------------------------------------------
                      (1)             (2)             (3)   
                    price            turn    displacement   
------------------------------------------------------------
mpg                -173.7         -0.0656          -1.777   
                  (-1.97)         (-0.88)         (-1.04)   

trunk              -0.855         -0.0593          0.0659   
                  (-0.01)         (-0.66)          (0.03)   

length              21.40           0.165***        3.068***
                   (0.79)          (7.19)          (5.83)   

_cons              5854.0           10.76*         -342.3** 
                   (0.97)          (2.09)         (-2.92)   
------------------------------------------------------------
numbers               one             two           three
more numbers         four            five             six
N                      74              74              74   
------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

显然,您每次都必须根据您的用例指定空格。您可以手动或通过编写计算这些的小程序来执行此操作。