IBw.d Format: Windows

Writes values in integer binary (fixed-point) format.

Category: Numeric
Alignment: Left
Windows specifics: native floating-point representation
See: IBw.d Format in SAS Formats and Informats: Reference

Syntax

IBw.d

Required Arguments

w

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

Default 4
Range 1–8

d

specifies a scaling factor. When you specify a d value, the IBw.d format multiplies the number by 10d, and then applies the integer binary format to that value.

Range 0–10

Details

The IBw.d format converts a double-precision number and writes it as an integer binary (fixed-point) value. Integers are stored in integer-binary (fixed-point) form.
For more information about microcomputer fixed-point values, see the Intel developer website.

Examples

Example 1: Processing a Positive Number

If you format 1.0 as the double-precision number, it is stored as an integer:
01 00 00 00 00 00 00 00
(Remember, Windows stores binary data in byte-reversed order.) The value written depends on the value that you specifyw.
If you specify the IB4. format, you receive the following value:
01 00 00 00
If you specify the IB2. format, you receive the following value:
01 00

Example 2: Processing a Negative Number

If you try to format −1 with the IB4. format, you receive the following value:
FF FF FF FF
If you specify the IB2. format, you receive the following value:
FF FF

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

When a numeric value is too large to format, the result is largest integer value that can be stored in four bytes, which is 2,147,483,647.
In the following code
data a;
   x = 9999999999999999999;
   y = put(x, IB8.);
   put y = hex16.;
run;
SAS returns the hexadecimal representation of 2147483647
 y=FFFFFFFFFFFFFF7F