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 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 5 Jan 2005 13:58:14 -0700
Reply-To:     Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Subject:      Re: Accumulated sum
Comments: To: heteroliu@GMAIL.COM
Content-Type: text/plain; charset=us-ascii

This would do it:

===== data test; do number = 10, 12, 13, 15; output; end; run;

proc report data=test missing nowindows;

column number acc;

define number / display; define acc / computed;

compute acc; acc_temp = sum(acc_temp, number); acc = acc_temp; endcomp;

run; =====

acc_temp is not listed in the column statement, so it acts like a retain data step variable. This general technique can be quite powerful. Another common use is to add pseudo-observation numbers to PROC REPORT output.

-- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA

Coelum, non animum mutant, qui trans mare currunt.

>>> "Richard" <heteroliu@GMAIL.COM> 01/05/2005 7:41 AM >>> Hi,

A very stupid question...

If I have data look like this

number --------- 10 12 13 15

and I would like to add a column as accumulated sum for this field...

number acc ---------------- 10 10 12 22 13 35 15 50

Can I do this in proc tabluate?

Thank you in advance.

"MMS <firsthealth.com>" made the following annotations. ------------------------------------------------------------------------------ This message, including any attachments, is intended solely for the use of the named recipient(s) and may contain confidential and/or privileged information. Any unauthorized review, use, disclosure or distribution of this communication(s) is expressly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy any and all copies of the original message. Thank you. =============================================================================


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