[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: tokenize `varlist' error?
At 11:15 AM 4/23/2004 -0400, Adrian Gonzales wrote:
The first version of varlist contains actual variable names, so -tokenize-
works fine. The second is an abbreviated list; it does not literally
contain all the variables you want, plus it has a hyphen, which is not
legal in variable names.
I want to perform a simple procedure over 100 variables and I don t want
to enter the name of each variable one by one.
If I use the first definition of varlist (below), my little procedure
works fine. But if I used the second definition of varlist, using - I get
an error (procedure below).
How can I solve this problem? I am sure this is very simple for most of
you, but I am new trying to do these things with Stata.
local varlist p26_1_1 p26_1_2 p26_1_3
local varlist p26_1_1-p26_1_3
What you want is -unab-, rather than -tokenize-.
Better yet, if this is in a program, use -syntax-.
Also, you might want to use -foreach- instead of -while- (does Stata 7 have
Institute for Policy Studies
Johns Hopkins University
* For searches and help try: