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 (September 2000, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 4 Sep 2000 08:10:50 -0400
Reply-To:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:   Re: cumulative sum

On Sun, 3 Sep 2000 21:28:40 -0700, Loving U <lovingu@START3.COM> wrote:

>Hi All, > >proc tabulate can produce sum by group, but can cumulative sum be calculated >also ? If no how to do ? Thanks in advance > >i.e > > Total Cumulative >age grp Sum Sum >0-9 yrs 5452 5452 >10-19 yrs 3920 9372 >20-29 yrs 2851 12223 >30-39 yrs 2003 14226 >40-49 yrs 1310 15536 >50-59 yrs 886 16422 >60-69 yrs 583 17005 >70+ yrs 220 17225

try this:

data test; input age:$9. grp:$3. Sum Sumctrl; cards; 0-9 yrs 5452 5452 10-19 yrs 3920 9372 20-29 yrs 2851 12223 30-39 yrs 2003 14226 40-49 yrs 1310 15536 50-59 yrs 886 16422 60-69 yrs 583 17005 70+ yrs 220 17225 ; run;

data t; set test; retain sumt 0; sumt=sum(sum,sumt); run;

In sumt you'll find the cumulated SUM. SUMCTRL is only to prove the correctness.


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