Making some assumptions about the format of the data and the variables you want to keep in the output this should give you what you're asking for
data have;
length id $1 repeat 8. firstid $3;
infile datalines dlm='09'x missover truncover;
input id repeat firstid;
datalines;
1 0
2 0
3 1 2
4 0
5 0
6 1 4,5
;
run;
proc sql;
create table repeats
as select firstid
from have
where firstid ne "";
quit;
data repeatslong(keep=id);
set repeats;
if count(firstid,",") > 0 then do;
do i = 1 to (count(firstid,",")+1);
id=scan(firstid,i,",");
output;
end;
end;
else do;
id=firstid;
output;
end;
run;
proc sql;
create table want
as select id, repeat
from have
where id not in
(select id
from repeatslong)
;
quit;
... View more