Hello,
I want to determine whether an individual completed any form (event_date) within 60 days of their program (end_date).
I have a demo data below and am struggle with the code. Any help please.
data A;
input ssn @4 start_date :date9. @14 end_date :date9. @24 event_date :date9. ;
infile datalines firstobs=2 ;
informat start_date end_date event_date date9.;
format start_date end_date event_date date9.;
datalines;
id start_date end_date event_date
101 01DEC2021 28FEB2022 09NOV2020
101 16OCT2019 18NOV2019 03FEB2020
102 16OCT2019 18NOV2019 07MAY2020
103 03FEB2022 02MAY2022 08JUL2022
103 03FEB2022 12FEB2022 15JAN2023
;;
run;
For example, id 101 first end_date was 28FEB2022
but the event date was less than 60days there the first id will not be my desired output.
BUT id 101 second end_date was 18NOV2019
but the event date is 60days more than the end_date therefore the second ID will be part of my desired output. I don't want to dedup any data by id so I can capture all multiple events within one person(id).
Thanks in advance!
Do you mean like this:
data want;
set A;
where end_date+60 < event_date;
run;
?
Bart
Do you wish to calculate the difference between the event date and end date?
@Mazi if you have 60days to the enddate (enddate+60) and the results is within the event_date, thats what I want. If you add 60 to the enddate and the results is more, I want a separate output of it.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.