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

st: Re: scalars in loops

From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   st: Re: scalars in loops
Date   Tue, 15 Jun 2004 18:55:26 -0400

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

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.

> Dimitriy V. Masterov

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index