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]
Re: st: rename middle parts of variables
From
Richard Goldstein <[email protected]>
To
[email protected]
Subject
Re: st: rename middle parts of variables
Date
Mon, 07 Feb 2011 09:18:05 -0500
download -renvars- from ssc (-ssc install renvars-)
Rich
On 2/7/11 9:13 AM, Hewan Belay wrote:
> 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/