| Date: | Mon, 29 Oct 2001 16:20:19 -0500 |
| Reply-To: | Jay Weedon <jweedon@EARTHLINK.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jay Weedon <jweedon@EARTHLINK.NET> |
| Organization: | http://extra.newsguy.com |
| Subject: | Re: stepping through arrays ... |
| Content-Type: | text/plain; charset=us-ascii |
On 29 Oct 01 20:28:09 GMT, bnewlin@INSMED.COM (Stumped) wrote:
>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.
As far as I can see, the 1st set of averages is a subset of the 2nd
no? The first elements of both sets are the same, the 2nd element of
the 1st set is the same as the 6th element of the 2nd set etc.
If you just want to calculate all these averages you can use something
like:
%macro whatever(n);
data new;
set old;
%do ave=1 %to &n-4;
ave_&ave._%eval(&ave+4)=mean(d&ave-d%eval(&ave+4));
%end;
run;
%mend;
So if the d's end at d100 run
%whatever(100)
JW
|