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

st: time-series operator in -foreach- loop


From   Finne Håkon <Hakon.Finne@sintef.no>
To   statalist@hsphsun2.harvard.edu
Subject   st: time-series operator in -foreach- loop
Date   Tue, 2 Jul 2002 14:09:46 +0200

Dear Statalisters,

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?

-- Håkon
hakon.finne@sintef.no
*
*   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