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

st: Re: scalars in loops


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
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
restriction..

Michael Blasnik
michael.blasnik@verizon.net


----- Original Message ----- 
From: "Dimitriy V. Masterov" <dvmaster@lily.src.uchicago.edu>
To: <statalist@hsphsun2.harvard.edu>
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/



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