Quantcast

how to DE-CAPITALISE variables?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to DE-CAPITALISE variables?

Josef Montag
Hi all,

a sily/simple question: I have a dataset in which all variable names are in CAPITAL letters. Is there a simple way how to de-capitalise them?

Thanks a lot, Josef
*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

Jose Benuzillo
I think you can use the strlower function

string matrix strlower(string matrix s)

-j


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Josef Montag
Sent: Monday, June 28, 2010 9:50 AM
To: [hidden email]
Subject: st: how to DE-CAPITALISE variables?

Hi all,

a sily/simple question: I have a dataset in which all variable names are in CAPITAL letters. Is there a simple way how to de-capitalise them?

Thanks a lot, Josef
*
*   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/

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

Maarten buis
In reply to this post by Josef Montag
--- Josef Montag wrote
> I have a dataset in which all variable names are in CAPITAL letters.
> Is there a simple way how to de-capitalise them?


foreach var of varlist _all {
    local lower = lower(`var')
    rename `var' `lower'
}

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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

Lachenbruch, Peter
renvars varlist,lower
seems easiest

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Maarten buis
Sent: Monday, June 28, 2010 8:58 AM
To: stata list
Subject: RE: st: how to DE-CAPITALISE variables?

--- Josef Montag wrote
> I have a dataset in which all variable names are in CAPITAL letters.
> Is there a simple way how to de-capitalise them?


foreach var of varlist _all {
    local lower = lower(`var')
    rename `var' `lower'
}

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/

*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

Nick Cox
-renvars- is from the SJ. -search renvars- for locations.

Nick
[hidden email]

Lachenbruch, Peter

renvars varlist,lower
seems easiest

Maarten buis

--- Josef Montag wrote
> I have a dataset in which all variable names are in CAPITAL letters.
> Is there a simple way how to de-capitalise them?


foreach var of varlist _all {
    local lower = lower(`var')
    rename `var' `lower'
}


*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

David Elliott
In reply to this post by Jose Benuzillo
look up his rename variables ado: -renvars-
-net stb 60 dm88-

DC Elliott
*
*   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/
David Elliott MD, MSc
Nova Scotia Dept. of Health
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

Nick Cox
As earlier implied, this specific reference points to an out-of-date
version.

If interested, please download

SJ-5-4  dm88_1  . . . . . . . . . . . . . . . . .  Software update for
renvars
        (help renvars if installed) . . . . . . . . .  N. J. Cox and J.
Weesie
        Q4/05   SJ 5(4):607
        trimend() option added and help file updated

Nick
[hidden email]

David Elliott

look up his rename variables ado: -renvars-
-net stb 60 dm88-


*
*   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/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: how to DE-CAPITALISE variables?

David Elliott
Thank you, Nick - this gives me an opportunity to update my version.
-renvars- is always handy because many of my data imports come in with
CAPITALIZED varnames. 350 varnames can get tedious!

Incidentally - my list reader does wonky threading sometimes so I
missed your earlier (and more accurate) post.

DCE
*
*   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/
David Elliott MD, MSc
Nova Scotia Dept. of Health
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to DE-CAPITALISE variables?

nshephard
Administrator
In reply to this post by Josef Montag
Josef Montag wrote
Hi all,

a sily/simple question: I have a dataset in which all variable names are in CAPITAL letters. Is there a simple way how to de-capitalise them?

Out of curiosity where is your dataset coming from?

If you're -insheet-ing it from ASCII text files then the default behaviour is to lowercase all variable names unless the -, case- option is used which will preserve the case of variable names.

This in turn suggests another solution (although it has the drawback that you will loose all variable labelling and value encoding/labelling).

outsheet using tmp.txt
insheet using tmp.txt

Neil
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to DE-CAPITALISE variables?

Rajaram Subramanian Potty
Hi,

This is the command for changing the vairables from capital to lower case.

renvars  nameofvariables, lower

Thnaks

On Wed, Jun 30, 2010 at 3:00 PM, nshephard <[hidden email]> wrote:

>
> Josef Montag wrote:
>>
>> Hi all,
>>
>> a sily/simple question: I have a dataset in which all variable names are
>> in CAPITAL letters. Is there a simple way how to de-capitalise them?
>>
>
>
> Out of curiosity where is your dataset coming from?
>
> If you're -insheet-ing it from ASCII text files then the default behaviour
> is to lowercase all variable names unless the -, case- option is used which
> will preserve the case of variable names.
>
> This in turn suggests another solution (although it has the drawback that
> you will loose all variable labelling and value encoding/labelling).
>
> outsheet using tmp.txt
> insheet using tmp.txt
>
> Neil
> --
> View this message in context: http://statalist.1588530.n2.nabble.com/how-to-DE-CAPITALISE-variables-tp5231402p5237445.html
> Sent from the Statalist mailing list archive at Nabble.com.
> *
> *   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/
>

*
*   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/
Loading...