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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Kelvin Tan-2
Hi All,

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:

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

I would like to run a lot of robustness tests for my results. I don't
know want to have many files for different robustness tests. Rather, 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.

Thanks in advance.

Regards,
Kelvin

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Roy Wada-2
> 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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

Satyen Dubey
This post has NOT been accepted by the mailing list yet.
Dear Roy,

I tried the code that you have provided. After that i use the example that you have provided. Unfortunately, the output file is not proper. it shows the first regression results printed 3 times.

I use Stata 12 on Mac with Mavericks running.

Regards,

Satyen Dubey
Thanks & Regards,

Satyen Dubey
Loading...