Date: Thu, 22 Oct 2009 12:17:03 -0400
Reply-To: Norm Weston <nweston@AMGEN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Norm Weston <nweston@AMGEN.COM>
Subject: Re: macro?
Not 100% sure what you are doing, but try this:
%let maxn = 100;
data BL;
set allwks;
by dispname;
retain Tscore6 Tscore7 cnt;
if week='0';
if first.dispname then do;
Tscore6=0;
Tscore7=0;
cnt=0;
end;
array dts_(&maxn.) dts_1 - dts_&maxn.;
do x = 1 to &maxn.;
if dts_(x) eq . then dts_(x)=0;
end;
Tscore6 = Tscore6 + dts_6 ;
cnt = cnt + 1 ;
TS6 = Tscore6 / cnt ;
Tscore7 = Tscore7 + dts_7 ;
cnt = cnt + 1 ;
TS7 = Tscore7 / cnt;
run;
Obviously you need to set what your maxn value is, but it should get you
where you are going. Also, you can set your base number as well, and if
the values (dts_) go up in intervals, you can add "by 2" or whatever to
your do x = statement.
Good luck.
|