根据你的描述出来的结果和数据集B有出入!
data test;
input ID A1 SUBID;
cards;
1 1 1
2 2 1
2 3 2
2 3 3
3 2 1
3 2 2
4 4 1
4 3 2
4 4 3
4 2 4
5 1 1
6 2 2
6 2 2
;
run;
proc sql;
create table test_MAX_SUBID as
select id, max(SUBID) as MAX_SUBID
from test
group by id;
quit;
proc sql;
create table test_left_join as
select * from test left join test_MAX_SUBID
on test.id=test_MAX_SUBID.id;
run;
data b;
set test_left_join;
if A1^=MAX_SUBID;
run;