Date: Mon, 29 Oct 2001 15:49:48 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: stepping through arrays ...
Content-Type: text/plain
> From: Stumped [mailto:bnewlin@INSMED.COM]
> I have a list of variables d1-dnth and I'm looking for a
> quick solution to
> computing the average of d1-d5, d6-d10, etc. AND and also compute the
> average of d1-d5, d2-d6, d3-d7, etc. Then compare the differences in
> averages between the two methods.
>
> I've played around with it but now i'm resorting to SAS-L
> hoping to get
> someone to point me in the right direction.
array D(*) d1-dNth;
do I = 1 to dim(D) -5;
Avg = Avg(D(I), D(I+1), D(I+2), D(I+3), D(I+4));
output;end;
gee whiz what is this output data set gonna look like?
or you could transpose
and average the column where index in 1:5, 2:6, 3:7, etc.
d'oh! Why do you want to do this?
Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov
OpSys: Win_Pro Ver: 8.2
---> cheerful provider of UNTESTED SAS code from the KludgeWrx !*! <---
By using your intelligence
you can sometimes make your problems twice as complicated.
-- Ashleigh Brilliant
|