Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: changing values to either all caps or all lowercase


From   William Buchanan <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: changing values to either all caps or all lowercase
Date   Thu, 1 Nov 2012 05:07:30 -0700

replace thisvar = lower(thisvar)
replace thisvar = upper(thisvar)
replace thisvar = proper(thisvar)

Nick recommended you look at -help functions- which would clarify this for you. Additionally, -renvars- is a user written command (available from ssc), which renames variables and does not affect the contents of the variables.

HTH,
Billy

Sent from my iPhone

On Nov 1, 2012, at 4:46, Kathleen Oberst <[email protected]> wrote:

> I was not successful identifying a command that affected the values, I did find the command "renvars, upper" or "renvars, lower" for modifying the variable names. From your example, I'm interpreting that to mean that I have to create duplicates of all my variables in order to accomplish the same type of editing for the values, is my understanding correct?
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: Thursday, November 01, 2012 7:36 AM
> To: [email protected]
> Subject: Re: st: changing values to either all caps or all lowercase
> 
> -lower()- and -upper()- are functions, not commands. Dopey example:
> 
> sysuse auto
> gen lmake = lower(make)
> gen umake = upper(make)
> edit *make
> 
> Start with -help functions-.
> 
> Nick
> 
> On Thu, Nov 1, 2012 at 11:30 AM, Kathleen Oberst <[email protected]> wrote:
>> I have a variable (ex. City name) and I'm trying to clean it up. I have the same city entered in as all lowercase, first letter capitalized or all upper case. Is there a way to force them all into upper or lower case? I've tried the "lower" command but it was not recognized. I'm using version 11.
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index