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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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