DATA Step, Macro, Functions and more

check whether any date ranges for a patient overlap

Reply
New User
Posts: 1

check whether any date ranges for a patient overlap

I work on health care claims and right now I have a task to determine if any date ranges for a single patient overlap and I need to count the number of overlapping days for each date range for that patient. Here is the snap shot of the data. Also for the overlapping days I need to calculate the total dosage and also calculate the average dose for those overlapping days. Any help is greatly appreciated.

 

Capture.PNGoverlapping date ranges

Super User
Posts: 9,866

Re: check whether any date ranges for a patient overlap

Use the lag() function to retrieve the enddate of the previous observation, and compare that with the filldate of the current obs.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 1 reply
  • 57 views
  • 0 likes
  • 2 in conversation