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: rename middle parts of variables


From   Hewan Belay <[email protected]>
To   Stata List <[email protected]>
Subject   st: rename middle parts of variables
Date   Mon, 7 Feb 2011 06:13:17 -0800 (PST)

Dear Statalist,

I have a fairly simple question: I want to rename parts of variables; for example, I want to rename any part of a variable that is “gdp” to “inc”. So the command I’m looking for, once executed, would rename the variable algergdppur to algerincpur, and gdp2004 to inc2004, and turkey_gdp to turkey_inc. That is, the part of the variable I want to rename could show up anywhere in the variable: at the beginning, middle, or end. If there are a large number of variables, doing –rename- won’t do. Nor can I use renpfix or rensfix as these are only for cases where the part to be renamed is at the beginning or end (most of my cases are in the middle). Is there any straightforward way to do this?

Thanks!
Hewan



      

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index