Whilst there is a built-in format ( SizeKMG
) this will not work in the Terabyte range. Thankfully ChrisNZ provides us with a 'roll your own' format:
%let onetb=%sysevalf(1024**4);
proc format ;
picture sizekmgt 0 -< &onetb. = [sizekmg10.1]
&onetb. - high = '000000.9TB' (multiplier=%sysevalf(1/&onetb.)) ;
run;
Usage:
data demo;
format size sizekmgt18.;
size=123; output;
size=12345; output;
size=123456789; output;
size=123456789012; output;
size=123456789012345; output;
run;
Which gives: