Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Rename problem: r(110) already defined


From   Richard Williams <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: Rename problem: r(110) already defined
Date   Tue, 12 Feb 2008 18:14:46 -0500

At 05:53 PM 2/12/2008, Friedrich Huebler wrote:
I am trying to convert all variable names in my data to lowercase,
using the commands below. The -rename- command returns error code 110
"already defined" if a variable name is already lowercase.

ds
local vars "`r(varlist)'"
foreach v of local vars {
  local newname = lower("`v'")
  rename `v' `newname'
}
How about changing the rename command to

if "`v'" != "`newname'" rename `v' `newname'

You might also consider the Weesie and Cox -renvars- command, which is dm88_1 from the Stata Journal.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam

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