BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I've encountered a metric spec in one of our incentive program specifications which I've never had to program before. I can't come up with any pragmatic method that will render a solution.

The wording is as follows:
"Number of patients as defined in the eligible population for whom 3 or more professional encounters exist that are at least 7 days apart."

I've tried using lag,lag2,lagn.... functions to do this, but this would require hundreds of lines of code to accomodate patients with a dozen or more encounter dates.

Any help is appreciated. Thank you.
2 REPLIES 2
LinusH
Tourmaline | Level 20
This shouldn't be too difficult, unless if you data is structured in an odd way.
You can use lag or retain to check if the encounter is to be counted, and retain to keep track of the number of qualifying encounter per patient. When reading the last record for each patient, just out the ones that has 3 or more qualifying encounters.

Good luck!

/Linus
Data never sleeps
GertNissen
Barite | Level 11
Can you give us an example of your data ?

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

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 2 replies
  • 1495 views
  • 0 likes
  • 3 in conversation