Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

KnowledgeBase
Common questions and answers.

Resources
Entire collection of data resources.


Latest Data News

RSS Feed icon

Lessons from North of the Border

Nerd Alert: Dictionary of Numbers

International Migration Statistics for the US

Open Data Executive Order

Measuring Marriage & Divorce among Same-Sex Couples

Removing duplicate records

There are several ways to get rid of duplicate records in SAS. The examples below are for records that are exactly alike. If you need to get rid of records that have duplicate IDs, see Removing records with duplicate IDs.

First/Last Method - Retains first or last record and deletes duplicates

proc sort; by id;
data h;
   set input;
   by id;
if first.id;
proc print;
var id h;

In the above case, 'last.id' can be used in place of 'first.id.'

Option Method - option in PROC SORT for duplicates

proc sort noduprec; by id;
proc print;
var id h;