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 on April 23, and its replacement, is already up and running.

[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" <>
To   <>
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. 


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

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