Your question is kind of hard to understand.
data a;
input clusterid joblevel v1 v2;
datalines;
1 1 . 1
1 1 . 1
1 3 0 0
1 3 0 .
1 3 1 0
2 1 1 1
2 2 0 .
2 3 . 1
2 3 0 0
2 3 1 .
3 1 . 1
3 1 0 0
3 2 1 1
3 2 1 0
3 3 0 0
3 3 . .
3 3 0 1
;
run;
data want;
do until(last.joblevel);
set a;
by clusterid joblevel notsorted;
if first.clusterid then first=1;
new_v1=coalesce(new_v1,v1);
new_v2=coalesce(new_v2,v2);
end;
new_v1=coalesce(new_v1,1);
new_v2=coalesce(new_v2,1);
if first then output;
drop first;
run;
... View more