Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: question on outreg: rows out of order


From   "Jann, Ben" <ben.jann@soz.gess.ethz.ch>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: question on outreg: rows out of order
Date   Mon, 25 Apr 2005 21:27:08 +0200

Raymond,
have you tried -estout-? In your case, the following code 
should more or less reproduce your table (however, without the 
funny row ordering):

foreach el of local lhs {
 foreach r of local rhs {
  regress pc_`el' L.`r' y1990-y2002 sic21-sic39 epa2-epa10 ///
   if year>=1989 , robust cluster(triid_num)
  est sto `r'
 }
 unab drop: y1990-y2002 sic21-sic39 epa2-epa10
 estout * using OLS_`el'.txt, cells(b(fmt(%9.3f)) se(par star)) ///
  stats(N r2, label(Observations R-squared) fmt(%9.0g %9.2f)) ///
  drop(`drop' _cons) title(`el') label legend replace
 est drop _all
}

ben




> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of 
> Raymond Guiteras
> Sent: Monday, April 25, 2005 5:23 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: question on outreg: rows out of order
> 
> 
> Hi - I apologize if this has been answered before
> but I am seeing some strange behavior in the way
> outreg orders rows. 
> 
> I have read the section of the outreg help file that
> deals with row order and I don't think that
> explains what's happening, although perhaps it 
> does in some subtle way I'm missing.
> 
> Anyway, here's what's happening:
> 
> I am running a series of regressions with the same
> LHS variable (call it y) and looping through a few
> different RHS variables (call them x1,...,x9), along
> with a bunch of other RHS variables which stay constant
> from model to model (call them z).
> So each regression is of the form
> regress y xi z
> where i=1 in the first regression, i=2 in the second, etc.
> I'm using outreg with a varlist of xi _only_ to report the 
> coefficients, std errs, etc. on just x1, x2,..., x9 from 
> the different specifications in a single table.
> 
> Everything works fine except that the
> rows of the table are out of order. that is, the table
> reports specification 1 in row 1, spec 2 in row 2, then
> jumps to spec 9, spec 8,..., spec 3.
> 
> (This is kind of hard to explain in words but it should
> be pretty clear what I mean from taking a look at one
> of the tables:
> http://web.mit.edu/guiteras/Public/outreg/OLS_total_trial_outreg.xls
> Here's a snippet of the code I used to generate the table
> http://web.mit.edu/guiteras/Public/outreg/trial_outreg.txt )
> 
> Everything's labeled correctly and so on, but it just looks
> strange and confusing and would be a pain to correct by hand
> (i.e. by rearranging the rows in excel).
> 
> I have read carefully the section of the outreg help file that
> discusses row order but I don't think that explains what is
> going on, because the varlist in my outreg command is
> just a single variable.
> 
> If anyone has some advice on this please share.
> If my explanation of the problem needs clarification please
> tell me and I will try to do a better job.
> 
> Thanks,
> Raymond
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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