Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Transforming numeric to categorical (not to string!)

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Transforming numeric to categorical (not to string!)
Date   Fri, 13 Aug 2004 15:35:27 +0100

-labvalclone- is a wrapper for the creation 
and running of a do file defining a set of 
value labels, except that on each line of 
the do file the name of the value label 
is changed. 

For changing the labels in another file,
you could -label save- explicitly to 
a do file --- optionally change the value label name 
(e.g with the aid of a text editor) --- 
and run it with various data files. 

At its simplest, 

use A 
label save COLOURS using 
use B 
do colours
label val HUES COLOURS 

I once contemplated a -labelrename-. 
What put me off was mostly the thought 
that the program might be dangerous 
because of assumptions about what it did
and didn't do. That is, suppose you rename 
a set of value labels. You probably want 
to associate the newly named set with 
the variables its predecessor was previously linked to -- 
but you might not. It seemed better 
to leave users to work out the separate
steps they needed.

[email protected] 

Tewodaj Mogues

> Nick, your suggestions helped perfectly. -labvalclone- is 
> really great, and -ds,has()- is very useful if I have 
> multiple vars with the same label that I want to change. I 
> don't now but may in the future. -labvalclone- would be 
> especially helpful if I could this way carry over a set of 
> labels from one dataset to another (without having to merge a 
> variable that's in one dataset and has the desired labels, 
> into the other dataset). That is, I have in dataset A the 
> label name COLOURS with which are associated the value labels 
> red, libertarian-yellow, and blue, and which I use for the 
> variable PARTY_SHADES. Now I want to use COLOURS for the 
> variable HUES which is located in dataset B. Can I somehow 
> transfer labels across datasets? So far I have been creating 
> the label name and all value labels all over again in the new dataset.

*   For searches and help try:

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