Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Create Multiple Formatted Tables in a Single File with -outreg2-


From   Roy Wada <[email protected]>
To   [email protected]
Subject   Re: st: Create Multiple Formatted Tables in a Single File with -outreg2-
Date   Sat, 9 Jan 2010 00:06:54 -0800

> I would like to know if -outreg2- can produce multiple formatted
> tables in a single file. I do not mean to produce multiple regression
> results in a single table as the following code shown below:
>
> I would like to have all my robustness test in a single file. Ideally, I
> would like to have two tables from the above two regressions in a
> single file.

It depends on what you want. If you want the whole thing stacked on
top of each other, then the following codes will do it for you. You
will need -dataout- from ssc. I am posting it here because you are the
second person asking for this.

If you want it cleaned up into the so-called panel format, then it can
be done by tweaking it several ways. You could make changes somewhere
after -insheet- but before -outsheet-. You now have the latest
vaporware that will do exactly what you want.

Roy


prog drop _all
prog define panelout
qui {
syntax, use(str asis) save(str asis) *
preserve
tokenize `use'
local num 0
while "``num''"~="" {
local num=`num'+1
tempfile temp`num'
insheet using myfile1.txt, noname clear
save `temp`num''
}
use `temp1',clear
forval n=2/`num' {
append using `temp`n''
}
tempfile out
outsheet using `out', noname
}
dataout using `out', save(`save') `options'
end


sysuse auto, clear
regress price mpg trunk  weight length
outreg2 using myfile1, tex bdec(3) tdec(2) sdec(2) replace
regress price mpg trunk
outreg2 using myfile2, tex bdec(3) tdec(2) sdec(2) replace

panelout, save(panelstuff.txt) use(myfile1.txt myfile2.txt) excel replace
erase myfile1.txt
erase myfile2.txt
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index