BookmarkSubscribeRSS Feed
user40
Calcite | Level 5

I have some duplicated stays in my dataset that i need to extract the last number of this. In the same data I also have some id that have overlap dates, that i only need to take out the longest stay in hospital. In addition, I have also some stay in hospitals that one stay follow the other one. That i asked you what should I do? 

 

Se the following dataset that i have under here: Data that i haveData that i have

I want that i extract last observation for P00009779 that is sekv =5, max daydiff for P0000066881 that is daydiff =19 and sum all stays for P000209192 that is complicated for me. Is there a nice tip to do this for each problem and merge data after?

 

 

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Please post what you want the desired result to look like. Makes it much easier to provide a usable code answer.

user40
Calcite | Level 5
I cannot add code since the code on a server

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 712 views
  • 0 likes
  • 2 in conversation