Date: Wed, 20 Sep 2006 16:50:18 +0530
Reply-To: Ankur Shanker <ankur.shanker@EVALUESERVE.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ankur Shanker <ankur.shanker@EVALUESERVE.COM>
Subject: Re: Cumulative summing problem
Content-Type: text/plain; charset="us-ascii"
Thanks Gerhard!
Your code worked very fine.
Regards,
Ankur
Ankur Shanker
________________________________
Business Analyst, Data Analytics
Evalueserve
Tel: +91 124 415 4600 (ext: 4876)
Fax: +91 124 406 3430
www.evalueserve.com
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Gerhard Hellriegel
Sent: Wednesday, September 20, 2006 4:09 PM
To: SAS-L@LISTSERV.UGA.EDU
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
DISCLAIMER:
The information in this e-mail is the property of Evalueserve and is confidential and privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and will be unlawful. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
|