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

st: forvalues and _N

From   "Wallace, John" <>
To   "''" <>
Subject   st: forvalues and _N
Date   Thu, 2 Sep 2004 13:45:52 -0700

I have a problem using a forval loop to assign values to a numeric variable
(for brevity, assume that -encode- doesn't work here).  I want to loop
through the entire dataset, addressing each value in turn, so

.forval e = 1/_N

would appear to be the appropriate form.  I get an "invalid syntax" error
when I do so.

.di _N

gives me the expected result for this dataset, 2339.

.forval e = 1/2339

works as expected.
How am I screwing this up?

John Wallace | Research Associate | Test Method Development
AFFYMETRIX, INC. | 3380 Central Expressway | Santa Clara, CA 95051 | Tel: 
408-731-5574 | Fax:  408-481-0435

*   For searches and help try:

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