Let's consider Table name :MAST_CS;
contains field1,field2,field3,field4.. as fields say...last_name , first_name, date_of_birth, idnumber
1.using same table mapped to conditions as "NOT EQUAL " field values for Duplicates removal
2.using same table mapped to conditions as " EQUAL " field values for displaying only Duplicates
1.OUT1 dataset contains elimination of duplicate entries
proc sql;
create table mynodups as
SELECT distinct Table1.field1,Table1.field2,Table1.field3,Table1.field4
FROM MAST_CS Table1,MAST_CS Table2
WHERE Table1.field1 NOT EQUAL Table2.field1
AND Table1.field2 NOT EQUAL Table2.field2
AND Table1.field3 NOT EQUAL Table2.field3
AND Table1.field4 NOT EQUAL Table2.field 4;
quit;
Data out1;
set work.mynodups;
run;
2.OUT2 dataset contains only duplicate entries
Displaying Duplicates alone:
create table mydupsonly as
SELECT distinct Table1.field1,Table1.field2,Table1.field3,Table1.field4
FROM MAST_CS Table1,MAST_CS Table2
WHERE Table1.field1 == Table2.field1
AND Table1.field2 == Table2.field2
AND Table1.field3 == Table2.field3
AND Table1.field4 == Table2.field 4;
quit;
Data out2;
set work.mydupsonly;
run;