Date: Wed, 22 May 2002 08:53:20 -0400 Edward Heaton "SAS(r) Discussion" To: amy Edward Heaton Re: a small question? To: SAS-L@LISTSERV.VT.EDU text/plain; charset="iso-8859-1"

Amy,

I will leave the testing of this code to you. Here is the pseudocode.

Data something(drop=_:) ; Set freqOut ; Array r [*] Jan Feb March April ; Array c [*] JanCum FebCum MarchCum AprilCum ; c[1] = r[1] ; Do _i=2 to dim(r) ; c[_i] = r[_i] + c[_i-1] ; End ; Run ;

Is this what you need?

Ed

Edward Heaton, Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1550 Research Boulevard, Room 2018, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 294-3992 mailto:EdwardHeaton@westat.com http://www.westat.com

-----Original Message----- From: amy [mailto:amywang11790@YAHOO.COM] Sent: Tuesday, May 21, 2002 11:12 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: a small question?

Sorry, The first message was post by mistake: too quick to click on 'post' :).

My question is: The dataset as following: member_id time location 1001 03/2002 NY 1002 04/2002 CA 1004 01/2002 NJ .........

the frequency is following(the analysis variable is: member_id)

Jan Feb March April NY 1 1 3 4 CA 3 2 3 5 NJ 4 3 6 8 ...........

How can I get: Jan Feb March April NY 1 1 1 2 3 5 4 9 CA 3 3 2 5 3 8 5 13 NJ 4 4 3 7 6 13 8 21 ...........

i.e. the 2nd column of each month will be current count plus the accmulate 2nd col of feb 2=1+1,5=3+2,7=4+3; 2nd col of March 5=2+3,8=3+5,13=7+6; ...... How can I do it? Thank you very much.

Amy

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