Statalist


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

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


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: RE: Re: Changing the suffix on variable names
Date   Fri, 1 May 2009 14:26:20 +0200

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




HTH
Martin
_______________________
----- Original Message ----- From: "sdm1" <[email protected]>
To: <[email protected]>
Sent: Friday, May 01, 2009 1:12 PM
Subject: st: RE: Re: Changing the suffix on variable names


Thanks Martin!

Steve

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Martin Weiss
Sent: 01 May 2009 12:08
To: [email protected]
Subject: st: Re: Changing the suffix on variable names

<>
****
clear*
set obs 100

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

//rename all in one fell swoop
renvars _all,  postsub(_56epi _45epi)
****

HTH
Martin
_______________________
----- Original Message -----
From: "sdm1" <[email protected]>
To: <[email protected]>
Sent: Friday, May 01, 2009 12:57 PM
Subject: st: Changing the suffix on variable names


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?

Many thanks.

Steve

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


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

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


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