Statalist


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

RE: st: Rename variables to reflect values?


From   "Victor, Jennifer Nicoll" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Rename variables to reflect values?
Date   Fri, 5 Jun 2009 09:53:59 -0400

-Jennifer
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Roy Wada
Sent: Friday, June 05, 2009 1:25 AM
To: [email protected]
Subject: RE: st: Rename variables to reflect values?

> 
> Does anyone have a suggestion for how I could rename my variables to 
> reflect the values in an observation or a variable? Or any other 
> suggested shortcuts, short of making this long local macro?
>
> Jennifer

sysuse auto, clear
drop make headroom gear_ratio
foreach var of varlist _all {
   ren `var' `var'`=`var'[1]'
}
 
Roy
 
_________________________________________________________________
Windows Live(tm): Keep your life in sync. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_BR_life_in_synch_062009
*
*   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