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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.