
171
10
Useful SAS
®
Procedures
10.1 Using the SORT Procedure to Eliminate
Duplicate Observations
A data set often contains duplicate values across observations. Individual
records can be duplicated or a subset of variables among records can have
identical values. One way to eliminate duplicate records from a data set
is to use FIRST.VARIABLE and LAST.VARIABLE within the DATA step,
which was illustrated in Section 4.2.2. If you don’t want to alter the com-
position of your original data set, however, you can use the NODUPKEY or
the NODUPRECS options in the SORT procedure and send the output to a
second data set that is referenced in the OUT = opt ...