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

st: forvalues and _N


From   "Wallace, John" <John_Wallace@affymetrix.com>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
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:
*   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