Date: Thu, 28 Sep 2006 15:37:51 -0400
Reply-To: "data _null_;" <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_;" <datanull@GMAIL.COM>
Subject: Re: how do I create a sas dataset that calculates sum of every 10
observations?
In-Reply-To: <200609281915.k8SI8YhD005003@mailgw.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I use the MOD function for this type of grouping. A variation of the
following may be helpful.
data work.test;
do id = 1 to 220;
sum + id;;
if mod(id,10) eq 0 then do;
group + 1;
output;
sum = 0;
end;
end;
run;
proc print;
run;
On 9/28/06, Cecilia Kim <chkim@bethesda.med.navy.mil> wrote:
> I currently have a dataset with 220 observations.
>
> I would like to collapse this dataset to 22 observations where each row is
> a sum of every 10 consecutive observations. In another words, how do I
> create a sas dataset that calculates sum of every 10 observations?
>
|