BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I'm working on a large clinical dataset. I'd like to extract duplicates into a new table. Any idea on how to do this?
3 REPLIES 3
prholland
Fluorite | Level 6
Not really an EG issue, but you could put this into a Code node:

PROC SORT DATA = inputdsn OUT = temp;
BY var1 var2 var3;
RUN;

DATA unique duplicates;
SET temp;
BY var1 var2 var3;
IF NOT LAST.var3 THEN OUTPUT duplicates;
ELSE OUTPUT unique;
RUN;

"var1 var2 var3" are the variables used to identify the duplicated records. Your duplicate values will be in the "duplicates" data set. The individual unique records will be in the "unique" data set.

Is this what you were looking for?

.............Phil

Message was edited by: prholland Message was edited by: prholland
deleted_user
Not applicable
Its just what I'm looking for although I was hoping there would be a feature in enterprise guide that would do it...
Colin
Calcite | Level 5
If your client is version 9 then you can use DUPOUT

data in;
do x=1 to 6; output; end;
do x=1 to 2; output; end;
run;
proc sort data=in out=out nodupkey dupout=dupes;
by x;
run;

Colin

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1047 views
  • 0 likes
  • 3 in conversation