From | Adrian Gonzalez-Gonzalez <[email protected]> |
To | [email protected] |
Subject | st: tokenize `varlist' error? |
Date | Fri, 23 Apr 2004 11:15:32 -0400 |
Dear Statalisters 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. My version is 7.0 updated. Thanks a lot local varlist p26_1_1 p26_1_2 p26_1_3 local varlist p26_1_1-p26_1_3 tokenize `varlist' while "`1'" ~= "" { 2. generate a1997`1'_=0 3. replace a1997`1'=1 if `1'==1997 4. generate a1998`1'=0 5. replace a1998`1'=1 if `1'==1998 6. macro shift 7. } invalid syntax r(198); end of do-file r(198); Adrian Gonzalez Ph.D Candidate Agricultural, Environmental and Development Economics The |
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |