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

st: RE: Continuous to categorical variable

From   "Alicia Dowd" <>
To   <>
Subject   st: RE: Continuous to categorical variable
Date   Sat, 19 Oct 2002 17:16:49 -0400

I think you can do this using the generate and recode functions. The
user's manual gives various approaches to converting continuous to
categorical variables in section 28.1.2.

In your example I think you can:  

generate O_RCcat=recode(O_RC,30,35,40)

where the numbers are the upper limits of the new categories.

(If you have anyone younger than 25 in your data you need to modify
this; as I have it here everyone less than or equal to 30 years will be
included in the category where 30 is the upper limit.)

To check the results including missing values, you could use :

tabulate O_RCcat, missing 

-----Original Message-----
From: Nitin Jain [] 
Sent: Saturday, October 19, 2002 3:53 PM
Subject: st: Continuous to categorical variable

How can a convert a continuous variable within my
dataset, into categories?
e.g. My variable 0_RC has the following values:
I would like to convert 0_RC into a categorical
variable with the categories: 
25-30: if value is between 25 and 30
30-35: if value is between 30 and 35
35-40: if value is between 35 and 40
Thank you,

Nitin Jain, MBBS, MSPH
Research Associate,
Duke University, Durham, NC 27710
(919) 684-5603
School of Public Health
University of North Carolina at Chapel Hill

Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
*   For searches and help try:
*   For searches and help try:

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