data data2;
set data1;*data1为原始数据
retain x1 0 y1 0;
if result1=1 then x1=x;
if result2=1 then y1=y;
n1+result1;
run;
data data3;
set data2;
by n1 notsorted;
if ^first.n1 & n1^=0 & result1=0 & result2=1 then do;
if x1<y1 then z='<';
else if x1=y1 then z='=';
else z='>';
end;
run;proc sort data=data3(where=(z^='')) out=nodups1 nodupkey;
by n1;
run;