PDw.d Format

Writes data in packed decimal format.
Category: Numeric
Alignment: left
See: PDw.d Format: UNIX in SAS Companion for UNIX Environments

PDw.d Format: Windows in SAS Companion for Windows

PDw.d Format: z/OS in SAS Companion for z/OS

Syntax

PDw.d

Syntax Description

w
specifies the width of the output field. The w value specifies the number of bytes, not the number of digits. (In packed decimal data, each byte contains two digits.)
Default:1
Range:1–16
d
specifies to multiply the number by 10d. This argument is optional.
Default:0
Range:0–31

Details

Different operating environments store packed decimal values in different ways. However, the PDw.d format writes packed decimal values with consistent results if the values are created in the same type of operating environment that you use to run SAS.
The PDw.d format writes missing numerical data as –0. When the PDw.d informat reads a –0, it stores it as 0.

Comparisons

The following table compares packed decimal notation in several programming languages:
Language
Notation
SAS
PD4.
COBOL
COMP-3 PIC S9(7)
IBM 370 assembler
PL4
PL/I
FIXED DEC

Example

y=put(x,pd4.);
put y $hex8.; 
Value of x
Result 1
 
----+----1
128
00000128
1The result is a hexadecimal representation of a binary number written in packed decimal format. Each byte occupies one column of the output field.