03-26-2014 04:04 PM
I have a patient data set with all the dates that the patients attend the services. i want to calculate the retention date which is defined as: at least 2 visit dates 90 days apart. I transpose the data and calculated it but wondering is anybody have a better and easy way to do this?
example of the data set:
input id visit_dt;
03-26-2014 08:44 PM
Transposing the data allows all the incidents per ID to be in the same row, so they are all available in memory. The un-transposed data as shown could be analysed with multiple lag functions but you would need to know the maximum number of events per ID for the period to set up the required number of lags. You say you have a solution for the transposed data so I would stick with that (kinda curious to see how you proceeded, though).
03-27-2014 01:49 PM
I think we need to know more about how you define retained. "At least 2 visits 90 days apart" is subject to several interpretations. For example is the 90 days exactly equal (unlikely but...) less than equal to 90 days, strictly less than 90 days, greater than or equal to 90 days or strictly greater than 90 days.
Are the visits compared sequentially or over multiple visits (this is a big distinction if the intervals are greater than 90).
If sequential and less than 90 days then how do report something where the first 3 visit are considered retained but the last 2 or 3 visits are outside?
You data example should include which are considered retained and show at least one set that is retained and one which is not.
I've had to go over similar issues with my clients to get them to really define what they are looking for.