BookmarkSubscribeRSS Feed
danwarags
Obsidian | Level 7

Hello Everyone,

 

I have a sample dataset as shown below. Each ID has different dates. I want to get an output which satisfies two conditions. 

 

1. Keeping only the IDs which have atleast two dates.

2. Deleting the dulpicate dates for each ID. 

 

 

DateID
10/22/20141
10/22/20141
4/23/20141
5/25/20141
4/25/20142
10/22/20143
4/23/20143
4/25/20144
3/4/20144
5/5/20144
5/23/20145
5/25/20146
5/25/20146
5/25/20146
6/24/20146
6/25/20146
6/24/20146
5/8/20147
6/28/20148
6/28/20148
5/24/20149
5/24/20149
8/26/20149
8/26/20149

 

So, when the above conditions are met, My output should look like below. 

 

DateID
10/22/20141
4/23/20141
5/25/20141
10/22/20143
4/23/20143
4/25/20144
3/4/20144
5/5/20144
5/25/20146
6/24/20146
6/25/20146
5/24/20149
8/26/20149

 

Please guide me in coding this. 

 

Thank you

1 REPLY 1
Reeza
Super User

Look at proc sort 

For 1 you need NOUNIQRECS option

For 2 you need NODUPKEY option. 

 

You on should probably apply your second criteria first. 

 

 

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 638 views
  • 1 like
  • 2 in conversation