我的输出有以下代码:
sysuse auto,clear
clear matrix
local vars price weight length
foreach i of local vars{
qui mean `i'
mat `i'=r(table)
scalar mean_`i'=`i'[1,1]
scalar se_`i'=`i'[2,1]
scalar n_`i'=`i'[7,1]+1
scalar sd_`i'=se_`i'*sqrt(n_`i')
mat des_`i'=(n_`i',mean_`i',sd_`i')
mat colnames des_`i'=Observations Mean SD
mat rownames des_`i'=`i'
mat des_result=nullmat(des_result)\des_`i'
}
estout matrix(des_result,fmt(0 4 4))
---------------------------------------------------
des_result
Observations Mean SD
---------------------------------------------------
price . . .
weight . . .
length . . .
---------------------------------------------------
现在,如果我只将qui mean `i'
更改为mean `i'
,我会输出:
sysuse auto,clear
clear matrix
local vars price weight length
foreach i of local vars{
mean `i'
mat `i'=r(table)
scalar mean_`i'=`i'[1,1]
scalar se_`i'=`i'[2,1]
scalar n_`i'=`i'[7,1]+1
scalar sd_`i'=se_`i'*sqrt(n_`i')
mat des_`i'=(n_`i',mean_`i',sd_`i')
mat colnames des_`i'=Observations Mean SD
mat rownames des_`i'=`i'
mat des_result=nullmat(des_result)\des_`i'
}
estout matrix(des_result,fmt(0 4 4))
---------------------------------------------------
des_result
Observations Mean SD
---------------------------------------------------
price 74 6165.2568 2949.4959
weight 74 3019.4595 777.1936
length 74 187.9324 22.2663
---------------------------------------------------
我想知道为什么在使用qui
时我没有得到输出。请注意,这与estout
无关。它与mean
。
答案 0 :(得分:1)
我不使用estout
(SSC / SJ),但这显示(正如其他人报告的那样)我完全无法重现报告的问题,即当quietly
为. about
Stata/SE 13.1 for Windows (64-bit x86-64)
Revision 03 Jul 2014
Copyright 1985-2013 StataCorp LP
时,所需结果的矩阵为空应用:
. sysuse auto,clear
(1978 Automobile Data)
. clear matrix
. local vars price weight length
. foreach i of local vars{
2. qui mean `i'
3. mat `i'=r(table)
4. scalar mean_`i'=`i'[1,1]
5. scalar se_`i'=`i'[2,1]
6. scalar n_`i'=`i'[7,1]+1
7. scalar sd_`i'=se_`i'*sqrt(n_`i')
8. mat des_`i'=(n_`i',mean_`i',sd_`i')
9. mat colnames des_`i'=Observations Mean SD
10. mat rownames des_`i'=`i'
11. mat des_result=nullmat(des_result)\des_`i'
12. }
. mat li des_result
des_result[3,3]
Observations Mean SD
price 74 6165.2568 2949.4959
weight 74 3019.4595 777.19357
length 74 187.93243 22.26634
已删除本地和个人详细信息
{{1}}