Since you are looking for unique or distinct parents within subjects, there will be multiple solutions. Here is a DATA step solution, but it requires a SORT and therefore more passes of the data than does KSharp's solution.
[pre]data id;
infile datalines dlm=',';
input parentid subjid;
datalines;
123, 990
123, 991
124, 992
124, 990
run;
proc sort data=id nodupkey;
by subjid parentid;
run;
* parents should be unique within subjects;
data goodid
badid;
set id;
by subjid;
if not (first.subjid and last.subjid) then output badid;
else output goodid;
run;
title good id;
proc print data=goodid;
run;
title bad id;
proc print data=badid;
run;
[/pre]
... View more