Skip to content

Instantly share code, notes, and snippets.

@statgeek
Created July 10, 2017 16:07
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/1ff5a4aaca9b3f875d4defdaa598ae5e to your computer and use it in GitHub Desktop.
Save statgeek/1ff5a4aaca9b3f875d4defdaa598ae5e to your computer and use it in GitHub Desktop.
Identify and output duplicate records
/*This code demonstrates how to keep only duplicate observations in a data set*/
%*Create sample data set;
data have;
informat name $80.;
input name $ found;
cards;
If_True 1
If_True_kary 1
If_True_kary 1
If_True_John 3
If_Not 24
If_Not 24
If_Not_Carol 24
If_Not_Carol 24
If_Not_Carol 24
If_False_Joe 288
If_False_Joe 288
;
run;
%*Sort with NOUNIQUEREC option;
proc sort data=have out=duplicates nouniquerec;
by name found;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment