BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
chuakp
Obsidian | Level 7

Thanks, Patrick - you've helped me a tremendous amount and I really appreciate it.

slchen
Lapis Lazuli | Level 10

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;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 3889 views
  • 3 likes
  • 5 in conversation