As a minor variation, if you want to keep both variables ID1 and ID2, but with a unique row for each unique value, you could:
data work.have;
input id1 :$20. id2 :$20.;
cards;
990000 990000
990002 990000contour
990003 990002
990006 990003
990007 990006
990008 990007
990016 990008
990018 990016
990021 990018
990024 990021
;
data want (label="unmatched ID1's and unmatched ID2's");
set have (keep=id1 rename=id1=id in=in1)
have (keep=id2 rename=id2=id in=in2);
by id;
if first.id=1 and last.id=1;
if in1=1 then id1=id;
else id2=id;
drop id;
run;
proc print;
run;
which generates:
The SAS System
Obs
id1
id2
1
990000contour
2
990024
... View more