Thanks, Patrick - you've helped me a tremendous amount and I really appreciate it.
I am not sure about your conditions.
data have;
infile cards truncover ;
input (Dx_code_5digit1-Dx_code_5digit3 Dx_code_3digit1-Dx_code_3digit3)($);
cards;
0030 . . 003 . .
0032 . . 003 . .
0032 0030 . 003 003 .
0030 0085 0091 003 008 009
0030 0085 0090 003 008 009
0031 0080 0085 003 008 008
;
run;
data want;
set have;
array code_5 Dx_code_5digit1-Dx_code_5digit3;
array code_3 Dx_code_3digit1-Dx_code_3digit3;
do over code_5;
flag1=code_5 in ("0030", "0031", "0039") and code_3 in ('003');
if flag1=1 then leave;
end;
do over code_5;
flag2=(code_5 in ("0084" , "0085") and code_3 in ('008'));
if flag2=1 then leave;
end;
do over code_5;
flag3=(code_5 in ("0090") and code_3 in ( "009" ));
if flag3=1 then leave;
end;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.