Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Rename from UPPER to lowercase


From   Ada Ma <[email protected]>
To   [email protected]
Subject   Re: st: RE: Rename from UPPER to lowercase
Date   Fri, 28 Jan 2005 11:16:23 +0000

you might also investigate on using the -ds- command, it can saves you the effort of typing in the names of a long list of variables.

e.g. if you want to turn all variables's names into lowercase except for AGE, SEX, NAME, you can write:

ds AGE SEX NAME, not

foreach v of varlist `r(varlist)' {
rename `var' `=lower("`var'")'
}

Alternatively -renvars- also works.



David Harrison wrote:


Yes, e.g.

foreach v of varlist A B C {
ren `v' `=lower("`v'")'
}

But for flexible manipulation of variable names (including changing case), look at the -renvars- package:

findit renvars

David
[email protected]

-----Original Message-----
From: Paolo Grillo, MD [mailto:[email protected]]
Sent: 28 January 2005 09:47
To: [email protected]
Subject: st: Rename from UPPER to lowercase


I would like to rename a lot of varname from UPPER to lower case maintaining the same variable name.
Is it possible to use foreach?.
Thanks
Paolo Grillo


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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