Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: combining tables with -outreg-


From   Ricardo Ovaldia <[email protected]>
To   [email protected]
Subject   Re: st: combining tables with -outreg-
Date   Thu, 4 Aug 2011 09:27:46 -0700 (PDT)

Thank you John. Jus what I needed. Very helful.

Ricardo

Ricardo Ovaldia, MS
Statistician 
Oklahoma City, OK


--- On Wed, 8/3/11, John Luke Gallup <[email protected]> wrote:

> From: John Luke Gallup <[email protected]>
> Subject: Re: st: combining tables with -outreg-
> To: [email protected]
> Date: Wednesday, August 3, 2011, 5:16 PM
> Ricardo,
> 
> Sorry to miss your earlier post.
> 
> In the new version of -outreg-, you _can_ create two tables
> that are each merged from 2 regressions and write them to
> the same document.  The key is to avoid a -using-
> statement until you write each table to the document. 
> This is because each -outreg using filename, replace-
> overwrites the existing Word file.  
> 
> In simplest form, the code is like this:
> 
> . sysuse auto, clear
> . regress mpg  weight
> . outreg
> . regress mpg  weight if foreign==0
> . outreg using auto, merge replace     
> // write first table to the file auto.doc
> 
> . regress mpg  weight
> . outreg
> . regress mpg  weight if foreign==1
> . outreg using auto, merge addtable 
>     // add second table to the file auto.doc
> 
> I also simplified your -outreg- options a bit.  -se-
> is a synonym for -stats(b se)-.  -sdec(2,2)- is
> equivalent to -sdec(2)- (or to -bdec(2)- in this case with
> -se- since -bdec- applies to standard errors as well as
> coefficients).  -bfmt(f)- removes the comma for
> thousands from the default -bfmt(fc)- , but the default
> number format is already fixed format.  I think you
> want column titles of -ctitle("",All)- because -ctitle(All)-
> will place "All" above the variable names in the first table
> column, not above the regression coefficients.  The
> same is true for -ctitle("",Domestic)- in the second
> -outreg- call.
> 
> Modifying your code below:
> 
> . sysuse auto, clear
> . qui regress mpg  weight
> . qui outreg, nosubstat se nostar  ctitle("",All)
> sdec(2) bfmt(f)
> . qui regress mpg  weight if foreign==0
> . qui outreg using auto, nosubstat se nostar
> ctitle("",Domestic) sdec(2) bfmt(f) merge replace
> 
> . qui regress mpg  weight
> . qui outreg, nosubstat se nostar ctitle("",All) sdec(2)
> bfmt(f)
> . qui regress mpg  weight if foreign==1
> . qui outreg using auto, nosubstat se nostar
> ctitle("",Foreign) sdec(2) bfmt(f) merge addtable
> 
> John
> 
> 
> John Luke Gallup
> Department of Economics
> Portland State University
> 
> 
> On Aug 3, 2011, at 6:41 AM, Ricardo Ovaldia wrote:
> 
> > I did not get a reply on my post, thus I assume that
> there is no way to do this other than to cut and paste.
> > 
> > Ricardo Ovaldia, MS
> > Statistician 
> > Oklahoma City, OK
> > 
> > 
> > --- On Tue, 8/2/11, Ricardo Ovaldia <[email protected]>
> wrote:
> > 
> >> From: Ricardo Ovaldia <[email protected]>
> >> Subject: st: combining tables with -outreg-
> >> To: [email protected]
> >> Date: Tuesday, August 2, 2011, 7:56 AM
> >> I am using the new -outreg- to create
> >> a report that is made up of three tables.
> >> Each table is made by merging 3 tables using
> >> -outreg,merge-.
> >> I want to use the new  -outreg, addtable-
> option to
> >> combine these tables. Is there a way to do this?
> >> 
> >> Here is a simple example using the auto data:
> >> 
> >> . sysuse auto, clear
> >> . qui regress mpg  weight
> >> . qui outreg using auto1, nosubstat stats(b se )
> >> nostar  ctitle(All) sdec(2,2) bfmt(f) 
> replace
> >> . qui regress mpg  weight if foreign==0
> >> . outreg using auto1, nosubstat stats(b se )
> nostar 
> >> ctitle(Domestic) sdec(2,2) bfmt(f)  replace
> merge
> >> 
> >> . qui regress mpg  weight
> >> . qui outreg using auto2, nosubstat stats(b se )
> >> nostar  ctitle(All) sdec(2,2) bfmt(f) 
> replace
> >> . qui regress mpg  weight if foreign==1
> >> . outreg using auto2, nosubstat stats(b se )
> nostar 
> >> ctitle(Foreign) sdec(2,2) bfmt(f)  replace
> merge
> >> 
> >> This code creates two separate tables by merging
> two other
> >> tables. I would like both tables in one document.
> >> 
> >> Thank you in advance,
> >> Ricardo
> >> 
> >> 
> >> 
> >> Ricardo Ovaldia, MS
> >> Statistician 
> >> Oklahoma City, OK
> >> 
> >> *
> >> *   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/
> >> 
> > 
> > *
> > *   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/
> > 
> 
> 
> *
> *   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/
> 

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index