LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2001, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 31 May 2001 15:23:00 -0400
Reply-To:     "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject:      Re: between
Content-Type: text/plain; charset="iso-8859-1"

Emrain:

You'll find the FORMAT procedure works well for this type of thing.

proc format; value ranges low-25='le 25' 26-35='26-35' 36-45='36-45' 46-high='gt 45' run;

data a; h = 10;output; h = 32;output; h = 22;output; h = 43;output; run;

data b; set a; age_cat = put(h,ranges.); run;

proc print;run;

Yields the following output:

OBS H AGE_CAT

1 10 le 25 2 32 26-35 3 22 le 25 4 43 36-45

-----Original Message----- From: EMRAIN [mailto:emrain@AOL.COM] Sent: May 31, 2001 2:59 PM To: SAS-L@LISTSERV.UGA.EDU Subject: between

Hi all,

I hope you can help me figure out what I am sure is a simple programming issue. I have the following data

id age 1 25 2 35 3 40 4 34

I want to create a categorical variable for age with a distribution of le 25 26-30 31-35 ect

How do I write "If" statements that will assign a value for anything in between two numbers?

I have tried : if =26 and le 30 then age_cat = '26-30'; This dosent work. Any help would be great!

Ellen


Back to: Top of message | Previous page | Main SAS-L page