There is not a SAS function for performing arbitrary radix to radix conversion.
You can write your own in Proc FCMP. For an arbitrary value representation in the originating radix, you would need to supply a list of glyphs representing the digits of the radix - likewise for the destination radix. You can find the use of base 5, 10, 12, 20, 60 in antiquity and nominally angular radixes of 360, 400 and π. A V7 SAS Name could be construed in a numeric sense as base 37.
Example:
Simplified for representing integer number in an integer radix from 2 to 33 using glyphs 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_
options cmplib = ();
proc fcmp outlib=sasuser.utility.number;
function IntToRadix(in_integer, in_radix) $33;
integer = abs(floor(in_integer));
radix = floor(in_radix);
glyphs = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_';
if radix > length(glyphs) or radix < 2 then
return (catx(' ', 'Radix', radix, 'not implemented.'));
sign = sign(in_integer);
length result $33;
result = '';
if radix > 1 then do place = 1 by 1 while (integer > 0);
remainder = mod(integer,radix);
result = cats(substr(glyphs,remainder+1,1), result);
integer = (integer - remainder) / radix;
if place >=7 then
leave;
end;
else do;
/* todo, stick marks for base 1*/
end;
if missing (result) then
result = '0';
else
if sign < 0 then
result = '-' || result;
return (result);
endsub;
quit;
options cmplib = sasuser.utility;
data representations;
do radix = 2 to 33;
do num = 0 to 100;
representation = IntToRadix(num,radix);
output;
end;
end;
run;
proc sort; by num radix;
proc transpose data=representations out=reptable prefix=radix_;
by num;
var representation;
id radix;
run;
... View more