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

Re: st: rename variables UPPERCASE to lowercase

From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: rename variables UPPERCASE to lowercase
Date   Mon, 26 Apr 2004 08:55:29 -0400

At 12:59 PM 4/26/2004 +0100, you wrote:

I need to convert all variable names from UPPERCASE to lowercase. How can I do that?

Many thanks.

Ada Ma

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

This will cycle through every variable in the dataset, renaming each to its equivalent, all-lower-case self.

Or I'm sure there are canned solutions out there, but this is a case, for me at least, where knowing a bit about -foreach- and local macros is far easier than remembering which canned solution does this little job...

--Nick Winter

*   For searches and help try:
Nicholas Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
308 White Hall w
Cornell University
Ithaca, NY 14853-4601
* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index