Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: how to rename a set of variables using foreach


From   Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: how to rename a set of variables using foreach
Date   Sun, 05 Feb 2012 12:04:48 +0000

Dear all,
I have a dataset with several dummy variables for income categories named:

inccatd1 inccatd2 inccatd3 inccatd4 inccatd5 etc till inccatd14

and I'd like to go 2 steps down in the numbers of income categories: i.e. I want inccatd3 to become inccatd1 etc. and I cannot quite figure out whether I can do it with foreach or not and all the advice I found so far is on using string commands.
I would be grateful for advice.
Ekaterina

*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index