Please find the output with the 2019 diagnosis date as well as the negative diagnosis time in the attached excel document. Other than the diagdate and diagtime, the other variables are the input variables with mock data. The code I used is below. data merge; merge bchist demog; by subject; where strip(trt) ne "001"; len = length(strip(date02)); select (len); when (4) diagdate = mdy(06,15,input(date02,4.)); when (7) diagdate = input("15"||date02, date9.); when (9) diagdate = input(date02,date9.); otherwise put 'Check obs ' _N_ date02=; end; format diagdate date9.; diagtime=intck('year',diagdate,daterand); run; Please let me know if you need any further information. Thanks for your help.
... View more