Finne H�kon
>
> With data -tsset- :
>
> . gen event = 0
>
> . foreach i in 1/10 {
> 2. replace event = 1 if D`i'.group==1
> 3. }
> D1 not found
> r(111);
>
> . replace event = 1 if D1.group==1
> (6589 real changes made)
>
> .
> Why doesn't -foreach- read D1. as a time series operator, and which is the
> better workaround?
I guess the problem here is not the obvious: it is
with the way -foreach- is involed, not with the time-series operator.
The two -foreach- syntaxes using -in- and -of- should
not be conflated.
Stata is probably trying to execute
... if D1/10.group==1
and failing because the numerator, -D1- is not
found.
More at Stata Journal 2(2), 202-222 (2002).
Nick
[email protected]
*
* 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/