University of Rochester Medical Center
SearchDirectoryNewsEventsStrong HealthURMC Home

SAS Helpful Hints

Duplicate Checks

Here is a quick method to detect duplicate records within a dataset:

* Be sure the dataset is sorted properly;
Proc Sort Data=work.A; By id; Run;

Data work.duplicates;
    Set work.A;
    By id;
    If Not(First.id) or Not(Last.id) then output work.duplicates;
Run;

 

Please send your comments and suggestions about this web page to A. Watts (watts@bst.rochester.edu)