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?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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