IBRw.d Informat

Reads integer binary (fixed-point) values in Intel and DEC formats.

Category: Numeric
Interaction: List input is incompatible with binary input when this informat is specified in an INFORMAT= statement or an ATTRIB= statement using the INFORMAT= argument. SAS issues a warning and uses formatted input to read the data.

Syntax

IBRw.d

Syntax Description

w

specifies the width of the input field.

Default 4
Range 1–8

d

specifies the power of 10 by which to divide the value. This argument is optional.

Range 0–10

Details

The IBRw.d informat reads integer binary (fixed-point) values, including negative values that are represented in two's complement notation. IBRw.d reads integer binary values that are generated by and for Intel and DEC platforms. Use IBRw.d to read integer binary data from Intel or DEC environments in other operating environments. The IBRw.d informat in SAS code allows for a portable implementation for reading the data in any operating environment.
Note: Different operating environments store integer binary values in different ways. This concept is called byte ordering. For a detailed discussion about byte ordering, see Byte Ordering for Integer Binary Data on Big Endian and Little Endian Platforms .

Comparisons

The IBw.d and PIBw.d informats are used to read native format integers. (Native format enables you to read and write values that are created in the same operating environment.) The IBRw.d and PIBRw.d informats are used to read little endian integers in any operating environment.
On Intel and DEC operating environments, the IBw.d and IBRw.d informats are equivalent.
To view a table that shows the type of informat to use with big endian and little endian integers, see Reading Data Generated on Big Endian or Little Endian Platforms.
To view a table that compares integer binary notation in several programming languages, see Integer Binary Notation and Different Programming Languages.

Example

You can use the INPUT statement and specify the IBR informat. However, in these examples that we use the informat with the INPUT function, where binary input values are described using a hexadecimal literal.
x=input('0100'x,ibr2.);
y=input('0001'x,ibr2.);
SAS Statement
Result on BigEndian Platforms
Result on LittleEndian Platforms
put x=;
put y=;
1
256
1
256

See Also

Informats: