Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72764

forvalues arguments

$
0
0
I can start a -forvalues- command with literal numbers as arguments

forvalues 1/10 {

but apparently not with builtin variables

forvalues 1/_N {

because that is a syntax error. Is there any way to get that effect? I trued

loc max _N
forvalues 1/`max' {

but that is also an "invalid syntax". although `max' does evaluate to a literal with the correct value.
I suppose I could write _N to a file and -include- the file, but this is an inner loop and I hope for
something faster. I would also be interested in something with the effect of

forvalues 1/var[`i'] {

if that were possible.

Daniel Feenberg
NBER
http://www.nber.org/stata/efficient

Viewing all articles
Browse latest Browse all 72764

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>