BookmarkSubscribeRSS Feed
eclaire
Calcite | Level 5

Hello, I need to delete observations that have an activity session outside of 1 week from admit or discharge.  My data look like the following:

(ID=subject, adate= admission date, ddate= discharge date, actdate= activity session date)

 

ID   adate        ddate          actdate

1    1/3/2021   1/30/2021   1/11/2021

1    1/3/2021   1/30/2021   1/9/2021

2    1/4/2021   1/29/2021   1/28/2021

2    1/4/2021   1/29/2021   1/15/2021

 

What I want:

 

ID   adate        ddate        actdate

1    1/3/2021   1/30/2021   1/9/2021

2    1/4/2021   1/29/2021   1/28/2021

 

 

Thank you!

1 REPLY 1
Kurt_Bremser
Super User

No observation satisfies your condition, as in all either the adate or the ddate are more than one week from actdate.

 

Or did you mean: actdate must be between one week before adate and one week after ddate?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 544 views
  • 0 likes
  • 2 in conversation