|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: problem creating and doing a foreach on a local of allnumeric variables in a dataset
From |
"Jennifer S. Earl" <[email protected]> |
To |
[email protected] |
Subject |
RE: st: problem creating and doing a foreach on a local of allnumeric variables in a dataset |
Date |
Wed, 27 Aug 2008 07:54:09 -0700 |
Thanks Maarten and Nick-- it runs now! I would have never figured out that
was the problem, especially since the "display `num_vars'" did display the
full list of variables I wanted even while I got the errors in the foreach
loop.
Just so I understand, though, I'll ask a follow-up:
Let's say I wanted to name the initial list of numeric variables something
different than the initial list of string variables (hence me trying to put
them in the local macros num_list and string_list) so I could use these
lists at different points later in the program and the lists would not be
affected by subsequently created variables (as they would if I just remade
the lists each time).
Right now, I could not do this because both the numeric and string lists
both appear to be called `r(varlist)' ; the contents just got replaced by
running "ds , has(type numeric)" or "ds , has(type string)" right before
the foreach loop.
How could I save off those initial lists and then later successfully
operate on them in a foreach loop?
Thanks again, I really appreciate it.
Cheers,
Jenn
*********************************
Jennifer Earl
Director, Center for Information Technology and Society
Associate Professor of Sociology
University of California, Santa Barbara
Santa Barbara, CA 93106-9430
P: (805) 893-7471
F: (805) 893-3324
*********************************
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/