Removing records with duplicate IDs

The following will get rid of records that have duplicate IDs.

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

However, before one gets rid of records with duplicate IDs, one should first determine why there are duplicate IDs. A common reason for duplicate IDs, is reading the ID in with an incorrect format. For instance, if one is reading in census tract IDs using the following:

input tract 52-57;

If the input data for columns 52-57 are as follows:

^201^^
^^^201

where ^ indicates a blank

Tract 201.00 and 2.01 will both be treated as 201 in SAS. To differentiate between the two, the following format should be used.

input @52 tract bz6.2;

NEW PSC blog

Recent resources, events, news

New Publications

Knodel et al. "Gendered Housework in Vietnam." PSC Research Report.

Couper. Designing Effective Web Surveys

Next Brown Bag

Monday, Oct 13
Jamie Jones
"Fertility & Risk Aversion on Utah Frontier"


W A R N I N G

If you are reading this, it may be that you are using rather old web browsing software that does not support modern international Web technology standards. For a better experience of the Web and this site in particular, please upgrade your web browser software today. The following are good choices: Firefox 2; Opera 9; Safari 3.