I am a beginner SAS user and would really appreciate some help. This is an example of the dataset I have for several thousands of patients: Patient_ID HF HF_date MI MI_date Stroke Stroke_date 1 0 . 1 31DEC2019 1 06AUG2005 HF=Heart Failure, MI=Myocardial Infarction I am working on a survival analysis and will need to do it for a composite outcome called MACE (which will the 3 variables in my dataset: HF, MI and stroke). I am trying to find the best way to create a MACE_date that reflects the earliest date if a patient has more than 2 outcomes. So for patient 1 above, I would want the MACE_date to be 06AUG2005 instead of 31DEC2019. I currently have: MACE=0; if HF=1 then MACE=1; if MI=1 then MACE=1; if stroke=1 then MACE=1; MACE_date=.; if HF=1 then MACE_date=HF_date; if MI=1 then MACE_date=MI_date; if Stroke=1 then MACE_date=Stroke_date; How can I code my SAS in a way where if a patient has multiple outcomes (HF and MI and stroke), that the MACE_date will reflect the earliest date? Is there an easy way to do this? Thank you so much in advance
... View more