LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 11 Jan 2008 08:53:20 -0800
Reply-To:     ChrisG <chris.godlewski@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         ChrisG <chris.godlewski@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: cumulative sum with subgroups ?
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On 11 jan, 17:50, ChrisG <chris.godlew...@gmail.com> wrote: > Hi > > Suppose i have such dataset : > > id date nnb sumnb > 1 10 2 15 > 1 11 1 15 > 1 12 1 20 > 1 13 1 10 > 2 7 1 150 > 2 9 1 200 > 2 10 2 150 > 2 17 1 300 > > i would like sas to do the following thing in a additional variable, > let call it cumsumnb : > > id date nnb sumnb cumsumnb > 1 10 2 15 15 > 1 11 1 15 30 > 1 12 1 20 50 > 1 13 1 10 60 > 2 7 1 150 150 > 2 9 1 200 350 > 2 10 2 150 500 > 2 17 1 300 800 > > in other words, to calculate in an 'incremental way' the cumulative > sum of sumnb by date within the id subgroup ... > > i hope i was clear enough ... > > many thanks for any help ! > > cheers > > CG

p.s. the variable nnb is useless here sorry ...


Back to: Top of message | Previous page | Main SAS-L page