A purely numeric method would be:
data test;
array _i{9};
array _o{*} _i8 _i9 _i6 _i7 _i1 _i2 _i3 _i4 _i5;
numIn = 123456789;
_x = numIn;
do i = dim(_i) to 1 by -1;
_i{i} = mod(_x, 10);
_x = int(_x/10);
end;
_x = 0;
do i = 1 to dim(_o);
_x = _x*10 + _o{i};
end;
numOut = _x;
drop i _:;
run;
This kind of math occurs behind the scene whenever you convert between number and character.
... View more