Thank you for your response. I greatly appreciate it. It gave me days between first and second episode, but there are clients with more than two episode dates three or sometimes four episode date in two year period. How do I modify the code to get days difference between second and third episode and third and fourth? Please!! I tried this but did not work. proc sql; create table repeat as select clientid, min(Episodedate) as Episode1, max(Episodedate) as Episode2, min(Episodedate) as Episode3, max(Episodedate) as Episode4, (calculated episode2 - calculated episode1) as repeat_inf_day1 (calculated episode3 - calculated episode2) as repeat_inf_day1 (calculated episode4 - calculated episode3) as repeat_inf_day3 from New_1 group by Clientid; quit;
... View more