> -----Original Message-----
> From: Jiang, Tao [mailto:[email protected]]
> Sent: Wednesday, November 27, 2002 11:22 AM
> To: '[email protected]'
> Subject: st: RE: 2k problem in forvalues
>
>
> I tried something on foreach, and I don't see why it doesn't work.
>
> Eg:
> . foreach j in 99 00 01 {
> 2. di "`j'"
> 3. }
> 99
> 00
> 01
>
This works because -foreach j in- takes a literal list of arbitrary
objects. -forvalues-, on the other hand, takes a numlist. So the
-foreach in- usage works fine for a list of three years, but it would
have to be
. foreach j in 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 00 01 01
{
for a longer list of years. -forvalues- knows how to fill in the
numlist automatically, but doesn't maintain a leading zero. Thus my
solotuion, posted before.
Nick Winter
*
* 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/