I have amended the following SAS codes for many times but turned out failed, I want to flag those cases with ever delinquency > 30 days by group, could anyone help to produce the desired results. Thank you. data Patients; input PatientID MOB DPD @@; datalines; 1021 1 10 1042 2 32 1053 1 36 1063 3 13 1053 2 17 1021 3 15 1063 1 11 1042 3 18 1021 2 32 1063 4 43 1042 1 60 1021 4 35 1063 2 12 1053 4 45 1053 3 19 1063 5 73 ; proc sort data=Patients; by PatientID MOB DPD; run; data Result; set Patients; by PatientID MOB DPD; retain ever_flag; if first.PatientID and DPD > 30 then ever_flag = "Y"; else ever_flag = "N"; run; Original Results (failed) Desired Results
... View more