将控制变量的名称添加到esttab输出中

时间:2019-04-30 15:25:32

标签: stata

我想用 community-contributed 命令esttab生成下表:

------------------------------------------------------------
                      (1)             (2)             (3)   
------------------------------------------------------------
rep78               2.384***        1.347*          1.149*  
                   (3.60)          (2.02)          (2.26)   

Other Cont~s         None      gear_ratio            size   

Foreign Co~s           No             Yes             Yes   
------------------------------------------------------------
N                      69              69              69   
------------------------------------------------------------

我能找到的最接近的是:

------------------------------------------------------------
                      (1)             (2)             (3)   
------------------------------------------------------------
rep78               2.384***        1.347*          1.149*  
                   (3.60)          (2.02)          (2.26)   

Foreign Co~s           No             Yes             Yes   
------------------------------------------------------------
Other Cont~s         None      gear_ratio            size   
N                      69              69              69   
------------------------------------------------------------

使我到达那里的代码如下:

sysuse auto, clear
eststo clear

eststo: reg mpg rep78
estadd local other_control "None"

eststo: reg mpg foreign rep78 gear_ratio 
estadd local other_control "gear_ratio"

eststo: reg mpg foreign rep78 weight length 
estadd local other_control "size"

esttab, obslast nomtitles nomtitles nodepvars eqlabels(none) keep(rep78) ///
scalars("other_control Other Controls") indicate("Foreign Controls = foreign")

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

实现所需输出的 only 方法如下:

sysuse auto, clear
eststo clear

eststo: reg mpg rep78
eststo: reg mpg foreign rep78 gear_ratio 
eststo: reg mpg foreign rep78 weight length 

local OtherControls Other Controls{dup 7: }none{dup 6: }gear_ratio{dup 12: }size
local ForeignControls Foreign Controls{dup 7: }no{dup 13: }yes{dup 13: }yes

esttab, nomtitles keep(rep78) ///
prefoot(`" "' `"`OtherControls'"' `" "' `"`ForeignControls'"' `"{hline 60}"')

------------------------------------------------------------
                      (1)             (2)             (3)   
------------------------------------------------------------
rep78               2.384***        1.347*          1.149*  
                   (3.60)          (2.02)          (2.26)   

Other Controls       none      gear_ratio            size

Foreign Controls       no             yes             yes
------------------------------------------------------------
N                      69              69              69   
------------------------------------------------------------