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 (April 1998, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 11 Apr 1998 06:53:52 GMT
Reply-To:   Andreas Grueninger <grueni@STUTTGART.NETSURF.DE>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Andreas Grueninger <grueni@STUTTGART.NETSURF.DE>
Organization:   LF.net GmbH, Internet Services, Stuttgart, Germany
Subject:   Re: weighted average based on lagged values

>If first.id then B = P * V >otherwise > B = 0.9 * previous value of B > plus > 0.1 * minimum of (5 * previous value of B) and (current P*V) > I defined a new variable bn to compare the values of b an bn. I gues you let the variable b in the data set mydata. This does not work. The new variable must not yet exist.

DATA mydata; INPUT ID P V B; CARDS; 123 10 1000 10000 123 9.5 200 9190 123 11 300 8601 123 10.1 900 8649.9 456 40 5000 200000 456 41 6000 204600 456 39.5 9000 219690 ; RUN; DATA ONE; RETAIN bn; SET MYDATA; BY ID; IF FIRST.ID THEN DO; bn = P * V; END; ELSE DO; bn = 0.9 * bn + MIN((5 * bn), P*V/10); END; RUN;

On Fri, 10 Apr 1998 15:20:37 -0600, Jennifer.Soller@bglobal.com wrote:

--------------------------- Andreas Grueninger

PRIVAT: grueni@stuttgart.netsurf.de OFFICIAL: grueninger@lfl.bwl.de ---------------------------


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