Stata 如何将固定效果模型标签添加到estout表?

Stata 如何将固定效果模型标签添加到estout表?,stata,Stata,您可以在下面找到我的代码: #delimit; local fixed_effect "Yes"; estout pre_post using output.xls, cells(b(star fmt(4) keep(post `ctrlVars')) t(par fmt(2) keep(post `ctrlVars'))) legend starlevels( * 0.10 ** 0.05 *** 0.010) stats(`fixed_effect' r2 N labels("In

您可以在下面找到我的代码:

#delimit;

local fixed_effect "Yes";

estout pre_post using output.xls, cells(b(star fmt(4) keep(post 
`ctrlVars')) t(par fmt(2) keep(post `ctrlVars'))) 
legend starlevels( * 0.10 ** 0.05 *** 0.010) stats(`fixed_effect' r2 N 
labels("Industry fixed effects" "Adjusted R-squared")) varlabels(_cons 
Constant) append;
这将产生以下错误消息:

 ( invalid name
"Industry fixed effects invalid name
"Adjusted R-squared invalid name
 ) invalid name
r(7);
怎么了


编辑:

抱歉说得不够清楚。这就是我想要的:

----------------------------
                      (1)   
             Industry FEs   
                      b/t   
----------------------------
mpg             -174.3133*  
                  (-1.99)   
headroom        -520.2934   
                  (-1.23)   
length            31.3659   
                   (1.30)   
Constant        5540.3487   
                   (0.94)   
----------------------------
Industry FE        Yes
Adjusted R~d       0.2454   
N                 74   
----------------------------
* p<0.10, ** p<0.05, *** p<0.010
----------------------------
(1)   
工业FEs
b/t
----------------------------
mpg-174.3133*
(-1.99)   
净空-520.2934
(-1.23)   
长度31.3659
(1.30)   
常数5540.3487
(0.94)   
----------------------------
是的
调整后的R~d为0.2454
N 74
----------------------------

*p我可以使用Stata的玩具数据集
auto
重现您的问题,如下所示:

sysuse auto, clear

regress price mpg headroom length

#delimit;

esttab ., cells(b(star fmt(4)) t(par fmt(2))) 
legend starlevels( * 0.10 ** 0.05 *** 0.010) stats(r2 N
label("Industry fixed effects" "Adjusted R-squared")) varlabels(_cons 
Constant);

( invalid name
"Industry fixed effects invalid name
"Adjusted R-squared invalid name
) invalid name
r(7);
发生此错误的原因是您错误地使用了社区贡献命令
estout
的选项:
labels()
stats()
的子选项,因此必须使用逗号分隔。此外,您需要独立选项
mlabels()
来指定自定义模型名称:

esttab ., cells(b(star fmt(4)) t(par fmt(2))) legend ///
starlevels(* 0.10 ** 0.05 *** 0.010) stats(r2 N, labels("Adjusted R-squared")) ///
mlabels("Industry FEs") varlabels(_cons Constant)

----------------------------
                      (1)   
             Industry FEs   
                      b/t   
----------------------------
mpg             -174.3133*  
                  (-1.99)   
headroom        -520.2934   
                  (-1.23)   
length            31.3659   
                   (1.30)   
Constant        5540.3487   
                   (0.94)   
----------------------------
Adjusted R~d       0.2454   
N                 74.0000   
----------------------------
* p<0.10, ** p<0.05, *** p<0.010

将来,请向我们提供示例数据,以便我们能够轻松地复制问题。请阅读此帮助。
sysuse auto, clear

regress price mpg headroom length

estadd local fe Yes

esttab ., cells(b(star fmt(4)) t(par fmt(2))) legend ///
starlevels(* 0.10 ** 0.05 *** 0.010) stats(fe r2 N, ///
labels("Industry FE" "Adjusted R-squared")) ///
mlabels("Industry FEs") varlabels(_cons Constant)


----------------------------
                      (1)   
             Industry FEs   
                      b/t   
----------------------------
mpg             -174.3133*  
                  (-1.99)   
headroom        -520.2934   
                  (-1.23)   
length            31.3659   
                   (1.30)   
Constant        5540.3487   
                   (0.94)   
----------------------------
Industry FE           Yes   
Adjusted R~d       0.2454   
N                 74.0000   
----------------------------
* p<0.10, ** p<0.05, *** p<0.010