BookmarkSubscribeRSS Feed
avatar
Fluorite | Level 6


is there a way to identify duplicate ids in a file with 40,000 records?

Any suggestion would be greatly appreciated.

Thanks

7 REPLIES 7
Reeza
Super User

Task>Data>Sort> Under options, look for the first and the duplicate options.

Or look at proc sort.

avatar
Fluorite | Level 6

Thanks a lot. I have few methods to try now,

avatar
Fluorite | Level 6

data step using if not last.id then output dups;

else output unique; worked for me

Thanks

Reeza
Super User

it should be if not( last.id and first.id) to get both of the observations that are duplicate unless you want only the last one.

avatar
Fluorite | Level 6

Interesting. I wanted both records. Now I got it . Thanks for the correction. Never knew about this code (if not last.id and first.id)

Haris
Lapis Lazuli | Level 10

This would print all the records for IDs with multiple entries:

proc sql;

select *

from data

group by ID

having sum(*) GT 1;

quit;

Haikuo
Onyx | Level 15

40,000 does not sound too much for Proc SQL. The following code may also help you reach your goal;

proc sql;

  select * from yourdata group by ID having count(*)>1; quit;

Haikuo

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 7 replies
  • 5515 views
  • 0 likes
  • 4 in conversation