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 00:48:15 +0100 (BST)

Tewodaj Mogues wrote:

> Here's something I've been trying to figure out for a while, even though
> it seems so straightforward. How do I take a regular numerical variable
> called COLOUR that takes on the values 1, 2, and 3, and change it into a
> categorical variable so that 1 becomes "green", 2 becomes "blue" and 3
> "white"? I.e. when viewing the data in the data editor, say, I want to see
> the colour names and not the numbers. And yet if I were, say, to type
>     sum colour
> I want it to give me as the min "1, the max "3", the mean and std.dev.
> etc. So I don't want to make the variable a string variable.

Two steps:

(1) . label define colours 1 green 2 blue 3 white
(2) . label values colour colours

> A related question: Once I have achieved that, is there a way I can make
> the data editor window show me the number values instead of the name
> values of such categorical variables. That is, is there a way to toggle
> between one view and the other? SPSS, which is in many other ways of
> course inferior to stata, does however have such a toggle option that
> stata doesn't seem to have.

I'm not aware of any such toggle option, but I agree that having such an
option would be very beneficial.

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