Date: Fri, 30 Sep 2011 15:58:11 -0400
Reply-To: Tom Abernathy <tom.abernathy@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Tom Abernathy <tom.abernathy@GMAIL.COM>
Subject: Re: Arrays and data import
It would be easier to loop over the individual ages and add them to the
right bin.
I must be missing something in the structure of your data because I doubt
that you have counts for 209 year olds?
DATA totalsexbyage;
SET totalsexbyage;
ARRAY ind PCT0120001 -- PCT0120209;
ARRAY grp age1 - age16;
call missing(of grp(*));
do age=1 to dim(ind);
group = 1+int(age/5) ;
grp(group) = sum(grp(group),ind(age));
end;
RUN;
On Fri, 30 Sep 2011 15:41:12 -0400, SUBSCRIBE SAS-L Jonathan Law
<jmlaw@CBA.UA.EDU> wrote:
>The variables that go into the initialagegroups array are population for
>single years of age (e.g. 38 years old, 39 years old, etc.). I'm trying to
>aggregate them into 5-year age cohorts (e.g. 36-40 years old) by using the
>do loop.