data have;
a=1;b=1;c=1; output;
a=1;b=2;c=1; output;
a=2;b=2;c=1; output;
a=1;b=2;c=1; output;
a=1;b=2;c=1; output;
run;
/* for duplicates: Keeps the first rec in want1, moves all other recs to DupsWant1 */
proc sort data=have out=want1 dupout=DupsWant1 noduprec;
by a b c;
run;
/* Creates a table with duplicates, a table with all obs having no duplicates, and a table with all de-duped obs */
proc sql;
create table Duplicates as
select *, count(*) as N_Dups
from have
group by a,b,c
having count(*)>1
;
create table ObsWithNoDuplicates as
select *
from have
group by a,b,c
having count(*)=1
;
create table AllObsDeDuped as
select DISTINCT *
from have
;
quit;
HTH
Patrick