How about :
data have;
input Name $ Score;
cards;
A 766
A 9
A 93
A 869
A 143
B 8
B 119
B 362
B 6
B 95
C 524
C 99
C 123
C 176
C 210
D 8
D 0
D 31
D 123
D 12
;
run;
data want(drop= m n second);
n=0;m=0;
array x{999} _temporary_;
do until(last.name);
set have ;
by name;
n+1;x{n}=score;
if score lt 10 then m+1;
end;
second=smallest(2,of x{*}); call missing(of x{*});
do until(last.name);
set have ;
by name;
if score lt 10 then call missing(score);
else if m eq 1 and score eq second then call missing(score);
output;
end;
run;
Xia Keshan
... View more