From: Arthur Tabachneck on
Jeff,

Could you get what you want with something like:?

proc sort data=a out=want;
by run day;
run;

data want;
set want (rename=(mean1=mean1_in mean2=mean2_in));
by run day;
retain mean1 mean2;
if first.run then do;
mean1=mean1_in;
mean2=mean2_in;
end;
else do;
mean1=sum(mean1_in,mean1);
mean2=sum(mean2_in,mean2);
end;
run;

HTH,
Art
---------
On Fri, 4 Dec 2009 19:16:44 -0500, Jeff Magouirk
<jmagouirk(a)ASPENBIOPHARMA.COM> wrote:

>Dear SAS-L,
>
>Here is my issue, I have a dataset that I need to sum the rows, but here
>is my problem. I need to sum by day and by run. So for day 1 it is the
>sum of number for that day. Day 2 sums is Day 1 + Day 2 for each run.
>This goes on to n.
>
>Data a;
>input day run mean1 mean2;
>datalines;
>1 1 12 12.4
>1 2 14 14.3
>1 3 15.4 14
>2 1 13 12.6
>2 2 14 15.3
>2 3 12.5 15
>3 1 12.6 13.6
>3 2 15.6 14.8
>3 3 17.6 16.5
>4 1 12.6 13.8
>4 2 13.8 12.9
>4 3 11.5 11.6
>5 1 12.4 12.6
>5 2 13.7 12.8
>5 3 14.5 12.6
>6 1 12.3 16.5
>6 2 18.8 16.8
>6 3 17.5 19.6
>;
>
>I need to sum the day's means together for each run.
>
>For day 1, run 1 mean1 = 12; mean2 = 12.4
>For day2sum, run 1 mean1=25; mean2 = 25;
>For day5sum, run 1 mean1=62.6; mean2 = 65.0;
>
>Thanks in advance for your help.
>
>Jeff