|
data a;
input id a b;
datalines;
1 1 1
2 3 3
3 5 5
4 7 7
5 11 11
6 2 2
7 4 4
8 6 6
9 8 8
10 12 12
11 13 13
12 14 14
13 9 9
14 3 3
15 6 6
;
run;
data _null_;
if 0 then set a (rename=(a=_a));
if _n_=1 then do;
declare hash h(dataset:'a(rename=a=_a)',ordered:'a');
h.definekey('id');
h.definedata(all:'y');
h.definedone();
declare hiter hi('h');
call missing(id,_a ,b);
end;
do point=1 to n;
set a point=point nobs=n;
if point>=5 and mod(point,5)=0 and a>=10 then do;
do while (hi.setcur(key:id)=0);
hi.prev();
a=0;
h.replace(key:id,data:id,data:a,data: b);
leave;
end;
end;
end;
h.output(dataset:'want(rename=(_a=a)');
stop;
run;
|