Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Re: RE: Re: Changing the suffix on variable names


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: RE: Re: Changing the suffix on variable names
Date   Fri, 1 May 2009 13:36:13 +0100

Thanks for the plug, but -renames- (SSC) was superseded by -renvars-
(SJ). -renames- remains accessible only for the presumably rather small
but not necessarily empty set of users of Stata 6, who would not be able
to use -renvars-. (See the -njc_stuff- package on SSC if you seek
guidance on my public domain stuff, including what is superseded by
what.) 

In the same vein, we can mention -rensfix- (STB). Although StataCorp
provided -renpfix- they never wrote its twin, so Stephen Jenkins and I
wrote one. However, at least one of us regards -rensfix- as superseded
by the much more general -renvars-. 

. search rensfix

Keyword search

        Keywords:  rensfix
          Search:  (1) Official help files, FAQs, Examples, SJs, and
STBs

Search of official help files, FAQs, Examples, SJs, and STBs


STB-59  dm83  . . . . . . . . . . . . .  Renaming variables: changing
suffixes
        (help rensfix if installed) . . . . . . .  S. P. Jenkins and N.
J. Cox
        1/01    pp.5--6; STB Reprints Vol 10, pp.34--35
        renames variables by changing the suffix

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

Martin Weiss

Nick also has a package -ssc d  renames- which will do the job just as
well.

***
clear*
set obs 100

forv i=1/150{
 gen x`i'_56epi=runiform()
}

capt ssc inst renames
//rename all in one fell swoop
//renvars _all,  postsub(_56epi _45epi)
renames *_56epi , suffix(_45epi)
***

From: "sdm1" <sdm1@york.ac.uk>

> Thanks Martin!

Martin Weiss

> <>
> ****
> clear*
> set obs 100
>
> forv i=1/150{
> gen x`i'_56epi=runiform()
> }
>
> //rename all in one fell swoop
> renvars _all,  postsub(_56epi _45epi)
> ****
>
> From: "sdm1" <sdm1@york.ac.uk>

>>I have 150 variables all with the same suffix.  I'd like to be able to
>> change this suffix to a different suffix (eg from '_56epi' to
'_45epi'.
>> Is
>> there an easier way to do this than using the 'rename' command 150
times?

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index