<>
Although "-14" leads to problems in the lag operator in the next line, so
indirectly "loc j" is not as innocent as I thought...
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Dienstag, 6. Oktober 2009 20:44
To: [email protected]
Subject: RE: st: RE: nested forvalues loop
<>
"loc j" is innocent :-) Stata regards it as empty first time through the
loop - so the first value is -14:
**************
clear*
forv i=14/24 {
loc j=`j'-14
di `j'
}
**************
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ariel Linden
Sent: Dienstag, 6. Oktober 2009 20:39
To: [email protected]
Subject: Re: st: RE: nested forvalues loop
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/
*
* 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/