Statalist


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

Re: st: RE: nested forvalues loop


From   "Ariel Linden" <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: nested forvalues loop
Date   Tue, 6 Oct 2009 11:39:02 -0700

Hi Austin,

I tried your suggested code and I am getting an error r(2000) which means no
observations.

Could it be because the line: loc j=`j'-14 starts without indicating what
the starting value of j is? 

I tried loc j=`i'-14 but that also returned the same error with no
observations.

Thanks for your help

Ariel


Date: Mon, 5 Oct 2009 15:27:37 -0400
From: Austin Nichols <[email protected]>
Subject: Re: st: RE: nested forvalues loop

Ariel Linden <[email protected]>:

Probably you are not running any logits. Maybe you want:

g double ps=.
forv i=14/24 {
 loc j=`j'-14
 logit Y l(0/`j').X1 l(0/`j').X2 l(0/`j').X3 if month==`i'
 tempvar w
 predict double `w'
 replace ps=`w' if e(sample)
 drop `w'
}

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index