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

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


From   TEWODAJ MOGUES <tmogues@students.wisc.edu>
To   Stata _ <statalist@hsphsun2.harvard.edu>
Subject   st: Transforming numeric to categorical (not to string!)
Date   Sat, 21 Aug 2004 11:14:59 -0400

Nick,

The solution of -label save- is exactly what I wanted. It's a good thing to remind oneself (i.e. myself) that the various commands are really canned do files that one can save to a separate file and run in another dataset. 

I agree with you that it is a good idea to separate the steps of creating a set of value labels on the one hand, and attaching this set to variables on the other. 

Thanks,
Tewodaj

   Date: Fri, 13 Aug 2004 15:35:27 +0100
   From: "Nick Cox" <n.j.cox@durham.ac.uk>
Subject: RE: st: Transforming numeric to categorical (not to string!)

-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 colours.do 
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.

Nick 
n.j.cox@durham.ac.uk 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
Tewodaj Mogues
Dept. of Agricultural and Applied Economics
University of Wisconsin - Madison
427 Lorch St. #317, Taylor Hall
Madison, WI 53706

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index