|
>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
---------------------------
|