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 (November 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 4 Nov 2005 08:34:01 -0800
Reply-To:     YI <yi_zhu_web@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         YI <yi_zhu_web@HOTMAIL.COM>
Subject:      Create a Roll Over Sum
Comments: To:
Content-Type: text/plain; charset="iso-8859-1"

Can anyone guide me how to figure out the following problem? Having a certain variable of data, I want to create another variable that sums up previous certain number of rows (including the current row) at each line. For example: With data Var1, and starting at row Three (say everything 3 steps), I want to create a variable Var2 that sums up previous 2 consecutive rows and the current row of Var1. Like the following: Var1 Var2 1 2 3 6 <-- sum(1+2+3) 4 9 <-- sum(2+3+4) 5 12 ... ... 6 15 7 18 8 21 9 24 <--sum(7+8+9)


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