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 at the end of May, 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 values to either all caps or all lowercase


From   Kathleen Oberst <Kathleen.Oberst@hc.msu.edu>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: changing values to either all caps or all lowercase
Date   Thu, 1 Nov 2012 12:50:59 +0000

Ah, the light bulb has turned on! I now understand you were suggesting to look for the topic "functions" from the help screen (clearly more coffee is needed). Nick, Daniel and William - thank you for your patience and suggestions.

K

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Thursday, November 01, 2012 8:24 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: changing values to either all caps or all lowercase

I gave you an example that you can try.

As others have emphasised,

1. changing the names of the variables

and

2. changing the values they contain

are completely different problems.

-renvars- (SJ) was for a decade the most versatile tool for renaming variables, but in Stata 12 -rename- is much revised and the first port of call.

But as said your problem is #1 not #2.

On Thu, Nov 1, 2012 at 11:46 AM, Kathleen Oberst <Kathleen.Oberst@hc.msu.edu> 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?

Nick Cox

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

> On Thu, Nov 1, 2012 at 11:30 AM, Kathleen Oberst <Kathleen.Oberst@hc.msu.edu> 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/


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