Responding to your original code, looks like you would like to parse across 50 columns(diag) and thru 1000 rosw to set condition for Arrhythemia. Heres my quick solution. Giv it a shot - data diag_array; set daig_cohort; eligdiag = 0; array diag(50) dx1-dx50; do i=1 to 50; IF diag(i) EQ '427.31' THEN DO; eligdiag = 1; Arrhythemia='flu1'; END; ELSE IF diag EQ '427.32' THEN Arrhythemia='flu2' THEN DO; eligdiag = 1; Arrhythemia='flu2'; END; ELSE IF diag in('427','427.0','427.2','427.3','427.60', '427.61', '427.8', '427.81', '427.89', '427.9') THEN DO; eligdiag = 1; Arrhythemia='Other'; END; ELSE DO; eligdiag = 0; Arrhythemia='None'; END; IF eligdiag = 1 then leave; end; DROP eligdiag; run; the LEAVE statement is the key here. Gud Luk!
... View more