Hello,
Does someone know how many significant digits do we have using a PD.6 format.
Could it be possible to get a table showing the number of significant digits for each PD.x format.
Regards,
I ran this test:
data test;
length checkvar $12;
input number;
checkvar = put(put(number,pd6.),$hex12.);
datalines;
123456789
-123456789
1234567890
-1234567890
12345678901
123456789012
1234567890123
;
proc print data=test;
run;
and got this result:
Beob. checkvar number 1 000123456789 123456789 2 800123456789 -123456789 3 001234567890 1234567890 4 801234567890 -1234567890 5 009999999999 12345678901 6 009999999999 123456789012 7 009999999999 1234567890123
So it can be seen that a full byte is reserved for the (possible) sign. This behavior is described in the OS-specific documentation of the PD format:
Digits or significant digits? Not the same thing. The significant digits are use specific.
The W is the number of BYTES in the output, and each byte has two digits. So PD6. = 12 digits.
Try it:
length checkvar $12;
checkvar = put(put(1234567123456,pd6.),$hex12.);
You are not starting with a packed decimal value.
I ran this test:
data test;
length checkvar $12;
input number;
checkvar = put(put(number,pd6.),$hex12.);
datalines;
123456789
-123456789
1234567890
-1234567890
12345678901
123456789012
1234567890123
;
proc print data=test;
run;
and got this result:
Beob. checkvar number 1 000123456789 123456789 2 800123456789 -123456789 3 001234567890 1234567890 4 801234567890 -1234567890 5 009999999999 12345678901 6 009999999999 123456789012 7 009999999999 1234567890123
So it can be seen that a full byte is reserved for the (possible) sign. This behavior is described in the OS-specific documentation of the PD format:
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: