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. 

 

 

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1371 views
  • 1 like
  • 2 in conversation