Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Change value labels to lowercase


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Re: Change value labels to lowercase
Date   Wed, 5 Apr 2006 17:18:42 -0700 (PDT)

Nick, sorry I was not precise. I wanted indeed to change the name of
each set of value labels from uppercase to lowercase. I also
neglected to mention that I use Stata/SE 8.2. Your commands work with
one change.

  local l : lower("`u'")

has to be

  local l = lower("`u'")

Thank you,

Friedrich

--- Nick Cox <[email protected]> wrote:
> Although you don't quite say so, it seems you want to 
> change the _name_ of each set of value labels and 
> not the labels themselves. 
> 
> Well, I think that is this: 
> 
> ds, has(vall) 
> local V "`r(varlist)'" 
> 
> foreach v of local V { 
> 	local u : value label `v' 
> 	local l : lower("`u'") 
> 	capture labvalclone `u' `l' 
> 	if _rc == 0 { 
> 		label val `v' `l' 
> 		label drop `u' 
> 	}
> }
> 
> but that's not tested. 
> 	
> Nick 
> [email protected] 
> 
> Friedrich Huebler
>  
> > > I want to change the value labels in my data from uppercase to
> > > lowercase. Assume I have data like this:
> > > 
> > > variable     value
> > > name         label
> > > -------------------
> > > var019
> > > var020       VAR020
> > > var021
> > > var022
> > > var023       VAR023
> > > var024       VAR024
> > > 
> > > Variable names are all lowercase. Value labels are the same as
> > > the variable names but are all uppercase. How can I loop
> > > through all variables, identify those that have a value label,
> > > and change that value lable to lowercase?


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index