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   "Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Transforming numeric to categorical (not to string!)
Date   Wed, 11 Aug 2004 22:33:03 +0100 (BST)

Tewodaj Mogues replied:

> Clive, I your suggestions worked, thanks. Is there a way to change the
> name of the label title? In your example, the variable name is COLOUR, the
> label title is COLOURS, and the value labels are GREEN, WHITE, etc.
> Suppose I wanted to rename the label title to SHADES from its original
> name COLOURS, but retain all the value labels as are. Is there a way to do
> that that?

I don't really understand why you would need to do that. Certainly,
there's nothing I can see in the User's Guide ([U] 15.6.3 and 16.9) that
would allow you to change the name created after -label define-. If you
don't have lots of -label-s stored in your dataset (-label list- allows
you to check this), the only solution I'd suggust is:

. label drop _all
. label define shades 1 green 2 white 3 blue (or whatever)
. label values colour shades

A look at -whelp labels-, however, shows you that it _is_ possible to
-add- to -modify- the coding structure of -labels- already defined. For
example:

. label define colours 4 "red" 5 "yellow", add
. label define colours 1 "socialist red" 2 "conservative blue" 3 "liberal
  gold" 4 "mint sunrise" 5 "oatmeal tragedy", modify

This isn't necessarily what you wanted to read, but I rather think that
these functions are much more useful to you than merely changing the
-label- name.

I hope this helps.

CLIVE NICHOLAS        |t: 0(044)191 222 5969
Politics              |e: clive.nicholas@ncl.ac.uk
Newcastle University  |http://www.ncl.ac.uk/geps
*
*   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