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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1605 views
  • 3 likes
  • 5 in conversation