Bookmark and Share

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: Renaming variables


From   Richard Moverare <[email protected]>
To   statalist <[email protected]>
Subject   st: Renaming variables
Date   Mon, 13 Jan 2014 12:14:44 +0100

Dear Statalist,

I have a minor problem renaming some variables. I am sure there is
some simple solution, but at the moment I can't find it. I have a
dataset with variables named as follows:

VAR02_1
VAR02_2
VAR02_3
VAR03
VAR04c
VAR05_1
VAR05_2
and so on

The structure is VARXX and then sometimes a few more characters. I
would like to change these numbers, i.e. XX, by increasing there value
with, say 12. The characters following XX should not be changed. So
that, in my example, I get:

VAR14_1
VAR14_2
VAR14_3
VAR15
VAR16c
VAR17_1
VAR17_2
and so on

Any help would be greatly appreciated.

All the best, Rick
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index