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-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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