1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
/* Table de test */
data test;input col1 $ col2 $; cards;
AZERTY TYTREZA
AZERTY TYTREZ
AZORTU AZERTY
122 TYT122
;
run;
/* Calcul des variables de contrôle */
data test(drop=indice caractere diff1 diff2);set test;
diff1=0;diff2=0;
do indice = 1 to length(col1);
caractere = substr(col1,indice,1);
if index(col2,compress(caractere)) = 0 then diff1+1;
end;
do indice = 1 to length(col2);
caractere = substr(col2,indice,1);
if index(col1,compress(caractere)) = 0 then diff2+1;
end;
diff=max(diff1,diff2);
run;
proc print;run; |
Partager