Date: Wed, 10 Feb 2010 13:25:50 -0600
Reply-To: Robin R High <rhigh@UNMC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin R High <rhigh@UNMC.EDU>
Subject: Re: Automating age bin creation
In-Reply-To: <589e4890-c2fd-4bc1-96b9-2f63621f3277@36g2000yqu.googlegroups.com>
Content-Type: text/plain; charset="US-ASCII"
Yaw,
Here is an ARRAY approach with DO loop, though the preferred "something"
for me would be the FORMAT as previously illustrated.
data old;
array bnd{4} _temporary_ (0 1.5 4.5 7.5);
input agemo;
i=0;
do agecat = 0, 3, 6; i=i+1;
if agemo <= bnd{i+1} then leave;
end;
cards;
.1
1.49
1.5
1.51
3
4.5
5
;
proc print; run;
Robin High
From:
Yaw <linkyox@GMAIL.COM>
To:
SAS-L@LISTSERV.UGA.EDU
Date:
02/10/2010 12:43 PM
Subject:
Automating age bin creation
Sent by:
"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Dear all:
I want to create agebins in months but I find myself writing several
lines of codes for this task. Given the age range I have my current
method will take a long time to get all the codes in.
Is there anyway I can expeditiously do this? like with an array or
something?
Thanks,
Yaw
Here's what I have been doing tirelessly:
if agemos le 1.500 then agecat=0;
else if agemos gt 1.500 and agemos lt 4.500 then agecat=3;