Hi! I am trying to create a new cross-sectional age variable from the existing longitudinal age variable based on the patient's diabetes status during 10 visits. If the patient is non-diabetic, pre-diabetic or unknown through all the visits then age of patient will be the last age recorded, if the patient is diabetic at visit 5 then age of patient will be age when the patient was first recorded as diabetic (i.e. age at visit 5) Here's what i attempted. if diab in (1,3,4) then cross_age=last.age; else if diab=2 then cross_age=first.age; run; Thanks!
... View more