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: How to rename value label names to match variable names?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: How to rename value label names to match variable names?
Date   Mon, 17 May 2010 13:20:33 +0100

-labvalclone- (read "lab val clone") is as Martin says part of -labutil- on SSC. 

Stata 11 users can now use -label copy-. 

-labvalclone- remains of possible use to users of Stata 7 .. 10. 

Nick 
[email protected] 

Anna Reimondos

Thank you all for your further suggestions.
With the labmask, I had not realised that the label values were
dropped, so yes I would definitely need to use the decode option.

The labvalclone was another program I was not aware of and testing it
on my data it worked perfectly. The ds, has(vallabel)
is also good to know because initially when if was using "foreach var
of varlist _all { " to loop through the variables and was consequently
creating labels on variables such as ID or weight which did not
initially have labels.

On Sun, May 16, 2010 at 7:40 PM, Martin Weiss <[email protected]> wrote:

> You can also use NJC`s -labvalclone-, in combination with the -h extended_fcn-s:
>
>
> ***********
> sysuse nlsw88, clear
>
> //see initial state
> d
>
> capt which labvalclone
> if _rc ssc inst labutil
>
> //get all vars with value labels
> ds, has(vallabel)
>
> //cycle thru list and change val label name
> foreach var of varlist `r(varlist)'{
>        labvalclone "`:val lab `var''" "`var'"
>        la val `var' `var'
> }
>
> //see changes
> d
>
> //see whether labels are intact
> ta race
> ta occupation
> ***********
>

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


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