Stata:在Excel输出中将不同回归结果排列在一起

我正在运行一堆我想在Excel文件中报告的二元回归。 目前产生的表格如下所示:

var1 coef1a coef1b (tvalue1a)(tvalue1b) var2 coef2a coef2b (tvalue2a) (tvalue2b) ... 

其中...代表另外50个variables。 我知道这是很多问outreg但有一些方法来获得输出:

 var1 coef1a coef1b (tvalue1a)(tvalue1b) var2 coef2a coef2b (tvalue2a) (tvalue2b) ... 

尽pipe这两个系数来自不同的回归?

我只是对系数和t值感兴趣,其他统计不需要logging(常数,R2等)。

可重复的例子:

 clear all ssc install outreg2 sysuse auto local path yourpath cd "`path'" local vars mpg rep78 headroom trunk weight length local replace replace foreach i of local vars{ reg price `i' outreg2 using "$path\example.xls", ctitle("var1") long `replace' local replace reg price `i', robust outreg2 using "$path\example.xls", ctitle("var1") long `replace' } 

你是否尝试过SSC的ESTOUT模块?

 sysuse auto, clear eststo: quietly regress price weight mpg eststo: quietly regress price weight mpg foreign esttab 

您可以保存为.csv文件。 看例如

http://repec.org/bocode/e/estout/esttab.html#esttab010

其中有更多的例子。

编辑

ESTOUT的作者Ben Jann编写了一个程序,可以将模型结果堆叠起来,以便与esttab一起使用。 下面的例子程序:

 . capt prog drop appendmodels . *! version 1.0.0 14aug2007 Ben Jann . program appendmodels, eclass 1. // using first equation of model . version 8 2. syntax namelist 3. tempname b V tmp 4. foreach name of local namelist { 5. qui est restore `name' 6. mat `tmp' = e(b) 7. local eq1: coleq `tmp' 8. gettoken eq1 : eq1 9. mat `tmp' = `tmp'[1,"`eq1':"] 10. local cons = colnumb(`tmp',"_cons") 11. if `cons'<. & `cons'>1 { 12. mat `tmp' = `tmp'[1,1..`cons'-1] 13. } 14. mat `b' = nullmat(`b') , `tmp' 15. mat `tmp' = e(V) 16. mat `tmp' = `tmp'["`eq1':","`eq1':"] 17. if `cons'<. & `cons'>1 { 18. mat `tmp' = `tmp'[1..`cons'-1,1..`cons'-1] 19. } 20. capt confirm matrix `V' 21. if _rc { 22. mat `V' = `tmp' 23. } 24. else { 25. mat `V' = /// > ( `V' , J(rowsof(`V'),colsof(`tmp'),0) ) \ /// > ( J(rowsof(`tmp'),colsof(`V'),0) , `tmp' ) 26. } 27. } 28. local names: colfullnames `b' 29. mat coln `V' = `names' 30. mat rown `V' = `names' 31. eret post `b' `V' 32. eret local cmd "whatever" 33. end . sysuse auto (1978 Automobile Data) . eststo b1: quietly regress price weight . eststo b2: quietly regress price mpg . eststo b3: quietly regress price foreign . eststo bivar: appendmodels b1 b2 b3 . esttab b1 b2 b3 bivar, mtitles 

资料来源: http : //repec.org/bocode/e/estout/advanced.html#advanced901