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 decapitalise 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/ 
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 DECAPITALISE 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 decapitalise 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/ 
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 decapitalise 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/ 
renvars varlist,lower
seems easiest Tony Peter A. Lachenbruch Department of Public Health Oregon State University Corvallis, OR 97330 Phone: 5417373832 FAX: 5417374001 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 DECAPITALISE variables?  Josef Montag wrote > I have a dataset in which all variable names are in CAPITAL letters. > Is there a simple way how to decapitalise 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/ 
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 decapitalise 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/ 
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 
As earlier implied, this specific reference points to an outofdate
version. If interested, please download SJ54 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/ 
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 
Administrator

In reply to this post by Josef Montag
Out of curiosity where is your dataset coming from? If you're insheeting 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 
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 decapitalise them? >> > > > Out of curiosity where is your dataset coming from? > > If you're insheeting 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/howtoDECAPITALISEvariablestp5231402p5237445.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/ 
Free forum by Nabble  Edit this page 