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]

RE: st: rename middle parts of variables


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: rename middle parts of variables
Date   Mon, 7 Feb 2011 15:31:57 +0000

Meaning, 5-4 as explicit below. 

Nick 
n.j.cox@durham.ac.uk 

Nick Cox

As Hewan found out, Richard has good taste but mis-remembered where -renvars- comes from. 

The -renvars- files are all associated with the Stata Journal and its predecessor the Stata Technical Bulletin. If interested, please find the original write-up in STB-60 and the code files in the resources for SJ 5-1. 

SJ-5-4  dm88_1  . . . . . . . . . . . . . . . . .  Software update for renvars
        (help renvars if installed) . . . . . . . . .  N. J. Cox and J. Weesie
        Q4/05   SJ 5(4):607
        trimend() option added and help file updated

STB-60  dm88  . . . . . . . .  Renaming variables, multiply and systematically
        (help renvars if installed) . . . . . . . . .  N. J. Cox and J. Weesie
        3/01    pp.4--6; STB Reprints Vol 10, pp.41--44
        renames variables by changing prefixes, postfixes, substrings,
        or as specified by a user supplied rule

Hewan Belay

Great, thank you! I only used renvars to rename vars as in 
renvars x y \ a b
I didn't know about all its other wonderful functions!

--- On Mon, 2/7/11, Richard Goldstein 

> download -renvars- from ssc (-ssc install renvars-)

> On 2/7/11 9:13 AM, Hewan Belay wrote:
 
> 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?

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