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
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