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

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

From   "Friedrich Huebler" <>
Subject   Re: st: Rename problem: r(110) already defined
Date   Wed, 13 Feb 2008 14:20:32 -0500

Thanks to everyone who responded to my -rename- problem. I added an IF
command to the -foreach- loop and now have a solution that (a) ignores
variable names that are already lowercase and (b) stops execution of
the do-file if the names of two variables in the data differ only with
regard to upper or lower case.

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

The lines above can be replaced by a single command if -renvars- is installed.

. renvars, lower

Thanks again.

*   For searches and help try:

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