LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 20 May 1998 09:45:10 +0100
Reply-To:     David Yeates <david.yeates@health-care-epidemiology.oxford.ac.uk>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         David Yeates <david.yeates@HEALTH-CARE-EPIDEMIOLOGY.OXFORD.AC.UK>
Subject:      Re: cumulative sum
Comments: To: lhinner <lhinner@GWDG.DE>
Content-Type: text/plain; charset="iso-8859-1"

Patrick,

The SAS code to create the cumulative sum of variable x could look like...

data <dataset>; retain cum_x 0; cum_x + x; <other SAS code> run;

Hope this helps

David -- UHCE, Oxford University mailto:david.yeates@uhce.ox.ac.uk http://www.views-uk.demon.co.uk/

Ludger Hinners: >Has anybody tried (and succeeded...), say for a variable x with a series >of observations, to create a new variable cum_x containing the >cumulative sum of x (current value plus all previous values)??? i..e, if >x has the values 2, 0, 5, 3 than cum_x would have the values 2, 2, 7, >10. Any ideas what a relevant sascode could look like? >Many thanks > >Patrick Verissimo > >pveriss@gwdg.de >


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