Previous Page | Next Page

SAS Formats under Windows

PDw.d Format: Windows



Writes values in packed decimal data.
Category numeric
Width range: 1-16
Default width: 1
Decimal range: 1-31
Alignment: left
Windows specifics: How the values are interpreted as negative or positive
See: PDw.d in SAS Language Reference: Dictionary

Syntax
Details
Examples
Example 1: Processing a Positive Number
Example 2: Processing a Negative Number
Example 3: Processing a Number That Is Too Large To Format
See Also

Syntax

PDw.d

w

specifies the width of the output field in bytes (not digits).

d

specifies a scaling factor. When you specify a d value, the PDw.d format multiplies the number by 10d, and then applies the packed decimal format to that value.


Details

The PDw.d format writes double-precision numbers in packed decimal format. In packed decimal data, each byte contains two digits. The w value represents the number of bytes, not the number of digits. The value's sign is in the uppermost bit of the first byte (although the entire first byte is used for the sign).


Examples


Example 1: Processing a Positive Number

If you format 1143.0 using the PD2. format, you receive the following value:

00 43

If you specify PD4., you receive the following value:

00 00 11 43


Example 2: Processing a Negative Number

If you format -1143.0 using the PD2. format, you receive the following value:

80 43

If you specify the PD4. format, you receive the following value:

80 00 11 43


Example 3: Processing a Number That Is Too Large To Format

When a numeric value is too large to format, as in this example

data a;
   x = 1e308;
   y = put(x, PD16.2);
   put y = hex16.;
run;

the result is

y=0099999999999999


See Also

Previous Page | Next Page | Top of Page