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

st: Rename problem: r(110) already defined

From   "Friedrich Huebler" <>
Subject   st: Rename problem: r(110) already defined
Date   Tue, 12 Feb 2008 17:53:37 -0500

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.

local vars "`r(varlist)'"
foreach v of local vars {
  local newname = lower("`v'")
  rename `v' `newname'

The problem can be reproduced with the auto data.

. sysuse auto
. rename make make
make already defined

What is the rationale for disallowing -rename- in cases where there is
no other variable by the same name? In theory, no two variables in my
data have the same name, whether uppercase or lowercase. Can the
commands above be modified without resorting to -capture-? I would
like to avoid -capture rename- because if there are variables with the
same name it indicates a problem with the data and execution of the
do-file should stop at that point.


*   For searches and help try:

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