All-
I am trying to figure out the most efficient way to code for a "clean period," or a 6 month time period in which x=0.
there are three variables of interest for each observation
trigger date
claim date
x= 0 or 1
I'd like to make a new variable that flags the observation if x =1 and the time interval between the trigger date and the claim date is 6 months or less. INTCK doesn't seem appropriate because neither date is standardized. someone mentioned that PROC SQL "date matching" may be the right function, but I can't find syntax for that. any ideas?
Thank you!
I don't know what you mean by standardized date. If your dates are SAS dates, this would work:
data want;
set have;
back_pn_6_mo_event =
back_pn and
intck("MONTH", claim_date, trigger_date, "CONTINUOUS") <= 6 ;
run;
If your dates are not SAS dates, then make them so.
If you supply sample input and desired output data it would help to visualize your problem.
input:
trigger-date claim_date back_pn
1/13/13 2/13/12 1
1/13/13 4/20/12 0
1/13/13 7/25/12 0
1/13/13 10/15/12 1
2/18/13 8/19/12 0
2/18/13 9/8/12 1
3/12/13 11/30/12 1
3/12/13 12/13/12 1
3/12/13 12/28/12 1
output
trigger-date claim_date back_pn back_pn_6_mo_event
1/13/13 2/13/12 1 0
1/13/13 4/20/12 0 0
1/13/13 7/25/12 0 0
1/13/13 0/15/12 1 1
2/18/13 8/19/12 0 0
2/18/13 9/8/12 1 1
3/12/13 11/30/12 1 1
3/12/13 12/13/12 1 1
3/12/13 2/28/12 1 1
I don't know what you mean by standardized date. If your dates are SAS dates, this would work:
data want;
set have;
back_pn_6_mo_event =
back_pn and
intck("MONTH", claim_date, trigger_date, "CONTINUOUS") <= 6 ;
run;
If your dates are not SAS dates, then make them so.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.