Well, it seems from -help forvalues- that forvalues does not accept
expressions, only numbers. A local macro will work because it will be
transparently expanded into a number and so, for all purposes, it is a
number. On the other hand, a scalar would need to be evaluated and
therefore counts as an expression. I'm not sure why they made this
restriction..
Michael Blasnik
[email protected]
----- Original Message -----
From: "Dimitriy V. Masterov" <[email protected]>
To: <[email protected]>
Sent: Tuesday, June 15, 2004 6:27 PM
Subject: st: scalars in loops
> Can someone please explain to me why one cannot use scalars to define the
> upper bound in a range of a forvalues loop. A forvalues loop with a local
> works, a while loop with a scalar works, a while loop with a local works,
> but not a forvalues loop with a scalar. There seems to be nothing in the
> programming manual about this issue.
>
<snip>
> DVM
>
>
____________________________________________________________________________
___
> Dimitriy V. Masterov
>
*
* 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/