Date: Wed, 20 Sep 2006 06:38:59 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: Cumulative summing problem
Ankur,
it was clear enough. If you are sure that it is sorted by accountnum, you
can omit the sort in my other answer.
Also the solution brings not only the 4th day, but all subsequent from the
fourth up to the last in group. Also the LIMIT variable might be unnecessary
if the recharge_value is in each obs.
Regards,
Gerhard
On Wed, 20 Sep 2006 06:23:27 -0400, Ankur Shanker
<ankur.shanker@EVALUESERVE.COM> wrote:
>Hello,
>
>I think the dataset was not clear enough in the previous post. So, here's
>the new dataset. I have a cumulative summing problem. The dataset looks
>like the below given table.
>
>Accountnum cost day recharge_value
>
>1 2.5 1 20
>1 2.1 2 20
>1 3.6 3 20
>1 5.8 4 20
>2 1.25 1 40
>2 0.58 2 40
>3 0.89 1 20
>3 6.5 2 20
>3 1.54 3 20
>3 1.98 4 20
>4 0.25 1 20
>5 3.5 1 10
>5 2.6 2 10
>5 3.55 3 10
>5 4.1 4 10
>
>
>What i want to do is to sum the cost grouped by accountnum and then
>whenever the cumulative sum reaches the recharge_value, the corresponding
>day should be reported. For example, for the accountnum 1, if the
>cumulative value of the cost equals the recharge_value 20 on the 4th day,
>then i should get 4 in return. And this is to be done accountwise and for 7
>million observations.
>
>Thanks and regards,
>Ankur
|