As Tom has shown you control the leading zeros using the .z
using @Tom code see how the zeros only pad the spaces in front of the numbers If your output number is larger than the format for the value a decimal is included and the number is converted.
data test;
do i=0,1,2,10,12,112,456,9876,123456789 ;
z=i;
format z z8.;
char=put(i,Z8.);
output;
end;
run;
data _null_;
file log dsd ;
set test;
put (_all_) (+0);
run;
0,00000000,00000000
1,00000001,00000001
2,00000002,00000002
10,00000010,00000010
12,00000012,00000012
112,00000112,00000112
456,00000456,00000456
9876,00009876,00009876
123456789,1.2346E8,1.2346E8
... View more