Hello Kurt,
Sorry, for insisting 🙂 I adopted the algorithm to my data, but I don't have the right results, I'm wondering if I understand your proposition of code. My code is :
I attached the data Variation3 and file with the right results.
Thank you very much for your help !
data Variation4;
set Variation3;
by NO_POLICE;
retain DeltaEAs EAs EAs_avant;
if _n_=1 then do;
DeltaEAs=MT_EVT + 5;
EAs =max(MT_EA,MT_EVT);
end;
if _n_^=1 then do;
if MT_EVT=0 then DeltaEAs=0;
if MT_EVT>0 then DeltaEAs=MT_EVT;
if MT_EVT<0 then DeltaEAs=EAs_avant*(MT_EVT/MT_EA_AVMVT);
EAs=sum(EAs_avant,DeltaEAs);
end;
output;
EAs_avant = sum(EAs_avant,DeltaEAs);
run;
... View more