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

RE: st: Getting stuck at outreg


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Getting stuck at outreg
Date   Mon, 1 Dec 2003 16:23:02 -0000

if `l' == 2 

is the way to test for equality with 2. 

Does this stop _inside_ -outreg-? 

Nick 
[email protected] 

Ramani Gunatilaka

> Sorry to come up with yet another query so soon after my 
> last. But I am stuck.
> I am running regression-based decompositions of consumption 
> for three survey years. I want to use outreg so the output 
> is formatted nicely. Here is part of my code.
> 
> local fname3 "c:\data95\hhineqvar95"
> local fname2 "c:\data90\hhineqvar90"
> local fname1 "c:\data85\hhineqvar85"
> local l=1
> while `l'<=3 {
> 	drop _all
> 	use `fname`l'', clear
> 	regress  y var1 var2 var3 etc.
> 	if `l'<2{
> 	outreg using ineqdec.out, se bdec(2,5,2) bracket 
> noaster ctitle("1985") title ("Decomposition of inequality 
> by individual regressor") replace
> 	}
> 	if `l'>1 & `l'<3{
> 	outreg using ineqdec.out, se bdec(2,5,2) bracket 
> noaster ctitle("1990") append
> 	}
> 	if `l'>2 {
> 	outreg using ineqdec.out, se bdec(2,5,2) bracket 
> noaster ctitle("1995") append
> 	}
> 
> Thereafter the code goes on to 
> save Beta coefficients of the regression
> Multiply the variables by the Betas
> regress those variables on y, and
> save those Betas.
> I will spare you those details. 
> 
> My problem is that the loop runs once right through, 
> producing the expected output, then it produces the 
> regression output for the second run (1990), but gets stuck 
> somewhere at the second outreg. I set trace on, too, but 
> couldn't figure out what went wrong.
> The message I get when the whole thing stalls is,
> 
> invalid 'and' 
> r(198);
> 
> 
> I suspect something is wrong with my if statement. I 
> replaced the second with - if `l'=2{ -
> but that didn't work either. 
> Would anybody have any ideas?
> Thanks so much,
> Ramani
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index