Since it appears that you actually want to count the number of two's that appear, if I understand then something like this will do the counting:
data have;
input ID A B C D E F G ;
datalines;
1 0 2 2 0 1 0 2
2 2 2 1 2 2 2 1
3 2 0 0 0 1 1 2
4 1 2 2 2 2 2 1
;
data want;
set have;
Numberof2 = countc(cats(a,b,c,d,e,f,g),'2');
run;
You could use a custom format to assign text based on the value of Numberof2 or an it/then/else block to create a text variable.
Please note the data step to provide something code can be run against.
... View more