Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: changing names from UPPER to lower case


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   stata list <statalist@hsphsun2.harvard.edu>
Subject   RE: st: changing names from UPPER to lower case
Date   Fri, 19 Mar 2010 16:32:47 +0000 (GMT)

--- "Lachenbruch, Peter" wrote:
> I have a number of variables in uppercase that I want to change
> to lower case.

You need to make sure that Stata only sees your new variable 
name and not the function that leads to it. In the example
below that is achieved by surrounding -upper("`var'")- with
`= and '

(This does ofcourse exactly the opposite of what you wanted
to do, but did not have an example dataset with variable names
in capitals... )

*------------- begin example -------------
sysuse auto, clear
foreach var of varlist _all {
	rename `var' `= upper("`var'")'
}
*------------- end example ---------------
( For more on how to use examples I sent to statalist see:
 http://www.maartenbuis.nl/stata/exampleFAQ.html )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index