Skip to content

Instantly share code, notes, and snippets.

@statgeek
Created September 2, 2017 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save statgeek/5b00bc3db0a1b43b5d944bac2e866642 to your computer and use it in GitHub Desktop.
Save statgeek/5b00bc3db0a1b43b5d944bac2e866642 to your computer and use it in GitHub Desktop.
SAS - PROC SORT identifying duplicate records
/*This example demonstrates how to get a list of duplicates based on the key variables.
KEY variables are placed in the BY statement.
Any 'duplicates' according to the KEY variables are kept in the OUT= dataset
*/
*Generate sample data with duplicate KEY;
data class;
set sashelp.class sashelp.class(obs=5);
run;
*Use the NOUNIQUEKEYS to get rid of unique records and keep duplicates;
proc sort data=class nouniquekeys out=duplicates;
by name;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment