Here is basic logic for looping over an array or variables and checking if ANY of them meet some condition.
First set the overall result to FALSE. Then loop until you run out of elements or you find one that it TRUE.
data want;
set have;
array code [10] ;
any_a = 0;
do index=1 to dim(code) while (not any_a);
any_a = code[index] =: 'A';
end;
if ANY_A then output;
run;
You should explain what you mean by "combine". If you mean to place multiple values into one variable that is likely to become a variable that is extremely difficult to work with.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.