Hi all, I would like to select the patients with mental health diagnosis using ICD10 code. There were up to 30 diagnosis variables for each patient, I will define the patients having mental health diagnosis if the first letter of any 30 diagnosis variables is 'F', but it seems my code resulted in all missing in mental_flag, why? array dx(30) diag1-diag30; do i=1 to 30; if substr(dx(i),1,1)='F' then mental_flag=1; else if substr(dx(i),1,1) notin ("F","") then mental_flag=0; else if substr(dx(i),1,1) in ("") then mental_flag=.; end; drop i; Thanks!
... View more