BookmarkSubscribeRSS Feed
juliajulia
Obsidian | Level 7


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:

data test;

input id visit_dt;

cards;

1 01/12/2010

1 03/10/2010

1 06/13/2010

1 12/13/2010

2 01/12/2010

2 01/13/2010

2 03/13/2010

2 06/14/2010

;

run;

3 REPLIES 3
Reeza
Super User

What do you want the output to be?

RichardinOz
Quartz | Level 8

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).

Richard

ballardw
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 648 views
  • 0 likes
  • 4 in conversation