Hello. I have complex dataset that I am unsure on how to begin. For example - there are multiple rows per subject stratified by "method" 1 or 2. - If a subject has a "method=2" then I would like to take the next record of method = 2 instance for the same subject start date and make that as an end date, and repeat. If there is no more method =2 & (stop date IS available for method =1, i would like to make that as new_stop_date time OR if stop_date is NOT available for last method = 1 then I would like to assign static_date_time = new_stop_date_time. Sample dataset ID method start_date_time stop_date_time static_date_time 1 1 1/1/19 11:13 AM 1/11/2019 15:12 1 2 1/1/19 12:15 PM 1/11/2019 15:12 1 1 1/1/19 4:11 PM 1/11/2019 15:12 1 1 1/2/19 6:11 PM 1/11/2019 15:12 1 2 1/2/19 8:33 PM 1/11/2019 15:12 1 1 1/3/19 12:12 PM 1/4/2019 21:12:00 PM 1/11/2019 15:12 2 1 1/1/19 11:13 AM 1/11/2019 15:12 2 2 1/1/19 12:15 PM 1/11/2019 15:12 2 1 1/1/19 4:11 PM 1/11/2019 15:12 2 1 1/2/19 6:11 PM 1/11/2019 15:12 2 2 1/2/19 8:33 PM 1/11/2019 15:12 2 1 1/3/19 12:12 PM 1/11/2019 15:12 New dataset ID method start_date_time stop_date_time static_date_time new_stop_date 1 1 1/1/19 11:13 AM 1/11/2019 15:12 1 2 1/1/19 12:15 PM 1/11/2019 15:12 1/2/19 8:33 PM 1 1 1/1/19 4:11 PM 1/11/2019 15:12 1 1 1/2/19 6:11 PM 1/11/2019 15:12 1 2 1/2/19 8:33 PM 1/11/2019 15:12 1/4/2019 21:12:00 PM 1 1 1/3/19 12:12 PM 1/4/2019 21:12:00 PM 1/11/2019 15:12 2 1 1/1/19 11:13 AM 1/11/2019 15:12 2 2 1/1/19 12:15 PM 1/11/2019 15:12 1/2/19 8:33 PM 2 1 1/1/19 4:11 PM 1/11/2019 15:12 2 1 1/2/19 6:11 PM 1/11/2019 15:12 2 2 1/2/19 8:33 PM 1/11/2019 15:12 1/11/2019 15:12 2 1 1/3/19 12:12 PM 1/11/2019 15:12 I tried to use proc sql max stop date time per patient to join but I think I am doing it completely wrong Thanks so much for your help in advance!!
... View more