BookmarkSubscribeRSS Feed
CathyVI
Lapis Lazuli | Level 10

Hi,

I am trying to identify 2 visits atleast 90 days apart after intervention date. For example, if I have a dataset like this 

Intervention_date      Visit_1        Visit 2        Visit_3         Visit_4            follow-up date (intervention+365);  

         1/2/2020          4/2/2020    5/7/2020    6/8/2020         1/1/2021

         2/3/2020          5/4/2020    6/1/2020    8/4/2020        10/4/2020

 

I have the intervention date but I do not have visit_1 to visit_4 yet. I have created a follow_up date as 12 months after intervention date (intervention date + 365) so as to see all visit_dates. I would expect that my visit_1 to visit_4 should be within intervention and follow_up date.

 

Task 1: I will like to create  visit_1 which is the first visit for each individual after the intervention date. I am thinking of using visit_1 = min(Intervention_date); I do try it but did not work as expected.

 

Task 2: I will like to create the second visit (visit_2) which will be at least 90 days after the visit_1. So the way am thinking this will be if a person has there visit_2 at least 90 days after visit_1, then visit_2 =1; else visit_2=0;

 

Am struggling with doing this in SAS and will appreciate any help.

Thanks

 

 

1 REPLY 1
PaigeMiller
Diamond | Level 26

While I really don't understand your problem description, I will point out that if the variable Intervention_date has values that are true SAS date values (integers that represent the number of days since 10JAN1960), then all you need to do to find out the date K days in the future is to add K to the Intervention_date. Example:

 

followup_date=intervention_date+365;
format followup_date date9.; /* Or use any other date format you want */
--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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