data two;
set one;
a=7*substr(id,1,1)+9*substr(id,2,1)+10*substr(id,3,1)+5*substr(id,4,1)+8*substr(id,5,1)+4*substr(id,6,1)+2*substr(id,7,1)
+1*substr(id,8,1) +6*substr(id,9,1)+3*substr(id,10,1)+7*substr(id,11,1)+9*substr(id,12,1)+10*substr(id,13,1)+5*substr(id,14,1)
+8*substr(id,15,1)+4*substr(id,16,1)+2*substr(id,17,1);
b=mod(a,11);
c=substr(id,18,1);
select (b);
when (0) do;
if c="1" then d="right";
else d="wrong";
end;
when (1) do;
if c="0" then d="right";
else d="wrong";
end;
when (2) do;
if c="x" then d="right";
else d="wrong";
end;
when (3) do;
if c="9" then d="right";
else d="wrong";
end;
when (4) do;
if c="8" then d="right";
else d="wrong";
end;
when (5) do;
if c="7" then d="right";
else d="wrong";
end;
when (6) do;
if c="6" then d="right";
else d="wrong";
end;
when (7) do;
if c="5" then d="right";
else d="wrong";
end;
when (8) do;
if c="4" then d="right";
else d="wrong";
end;
when (9) do;
if c="3" then d="right";
else d="wrong";
end;
when (10) do;
if c="2" then d="right";
else d="wrong";
end;
otherwise;
end;
run;
data two;
set one;
a=7*substr(id,1,1)+9*substr(id,2,1)+10*substr(id,3,1)+5*substr(id,4,1)+8*substr(id,5,1)+4*substr(id,6,1)+2*substr(id,7,1)
+1*substr(id,8,1) +6*substr(id,9,1)+3*substr(id,10,1)+7*substr(id,11,1)+9*substr(id,12,1)+10*substr(id,13,1)+5*substr(id,14,1)
+8*substr(id,15,1)+4*substr(id,16,1)+2*substr(id,17,1);
b=mod(a,11);
c=substr(id,18,1);
select (b);
when (0) do;
if c="1" then d="right";
else d="wrong";
end;
when (1) do;
if c="0" then d="right";
else d="wrong";
end;
when (2) do;
if c="x" then d="right";
else d="wrong";
end;
when (3) do;
if c="9" then d="right";
else d="wrong";
end;
when (4) do;
if c="8" then d="right";
else d="wrong";
end;
when (5) do;
if c="7" then d="right";
else d="wrong";
end;
when (6) do;
if c="6" then d="right";
else d="wrong";
end;
when (7) do;
if c="5" then d="right";
else d="wrong";
end;
when (8) do;
if c="4" then d="right";
else d="wrong";
end;
when (9) do;
if c="3" then d="right";
else d="wrong";
end;
when (10) do;
if c="2" then d="right";
else d="wrong";
end;
otherwise;
end;
run;