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: outreg2 to latex and variable placement problem


From   John Luke Gallup <[email protected]>
To   [email protected]
Subject   Re: st: outreg2 to latex and variable placement problem
Date   Thu, 9 May 2013 09:28:50 -0700

Mike,

If you use the -sortvar- option, that should solve your problem:

reg enrolled hh_risk_1 hh_risk_2 age sex, r
outreg2 using enrolledreg, drop(hh_risk_2) tex(fragment) replace
reg enrolled hh_risk_1 hh_risk_2 age sex, r
outreg2 using enrolledreg, sortvar( hh_risk_1 hh_risk_2 age sex) tex(fragment)

John

On May 9, 2013, at 8:33 AM, Michael Tekle Palm <[email protected]> wrote:

> Hello Statalist!
> 
> I am compiling a table of two different regressions using the same dep. var. but alternate independent variables. I want these two independent variables to appear next to each other in the first column ("VARIABLES") of the outreg2 table. This is the code I'm using:
> 
> 
> 
> *** BEGIN STATA CODE ***
> 
> 
> reg enrolled hh_risk_1 hh_risk_2 age sex, r
> 
> outreg2 using enrolledreg, drop(hh_risk_2) tex(fragment) replace
> 
> reg enrolled hh_risk_1 hh_risk_2 age sex, r
> 
> outreg2 using enrolledreg, drop(hh_risk_1) tex(fragment)
> 
> 
> *** END STATA CODE ***
> 
> 
> The two independent variables of interest are hh_risk_1 and hh_risk_2. Note that I am using the option drop() in each outreg2 command. What happens is that the variable that is used in the second regression only (hh_risk_2) appears at the bottom row of the table. Initially, only one of the variables was included in each regression, but I included both variables in both regressions and added the drop() option in an attempt to let the variable appear but without the results. This did not work. 
> 
> I realize it appears in the bottom because it's the last new variable that is identified by outreg2, but I'd really love if someone could help with this simple(?) problem!
> 
> 
> To clarify, the left table is how I want it to look, and the right is what outreg2 produces:
> 
> 
> VARIABLES                       VARIABLES
> ---------                       ---------
> 
> hh_risk_1                       hh_risk_1
> 
> hh_risk_2                       age
> 
> age                             sex
> 
> sex                             hh_risk_2
> 
> 
> 
> Regards,
> 
> Mike 		 	   		  
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index