Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[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 <[email protected]>
To
"[email protected]" <[email protected]>
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/