PIBRw.d Informat

Reads positive integer binary (fixed-point) values in Intel and DEC formats.
Category: Numeric

Syntax

PIBRw.d

Syntax Description

w
specifies the width of the input field.
Default:1
Range:1–8
d
specifies the power of 10 by which to divide the value. This argument is optional.
Range:0–10

Details

All values are treated as positive. PIBRw.d reads positive integer binary values that have been generated by and for Intel and DEC operating environments. Use PIBRw.d to read positive integer binary data from Intel or DEC environments on other operating environments. The PIBRw.d informat in SAS code allows for a portable implementation for reading the data in any operating environment.
Note: Different operating environments store positive 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

  • Positive integer binary values are the same as integer binary values except that the sign bit is part of the value, which is always a positive integer. The PIBRw.d informat treats all values as positive and includes the sign bit as part of the value.
  • The PIBRw.d informat with a width of 1 results in a value that corresponds to the binary equivalent of the contents of a byte. This is useful if your data contain values between hexadecimal 80 and hexadecimal FF, where the high-order bit can be misinterpreted as a negative sign.
  • On Intel and DEC platforms, the PIBw.d and PIBRw.d informats are equivalent.
  • 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.
    To view a table that shows the type of informat to use with big endian and little endian integers, see SAS Informats and Byte Ordering .
    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 PIBR informat. However, these examples use the informat with the INPUT function, where binary input values are described using a hexadecimal literal.
 x=input('0100'x,pibr2.);
 y=input('0001'x,pibr2.);
SAS Statement
Result on Big Endian Platforms
Result on Little Endian Platforms
put x=;
put y=;
1
256
1
256

See Also

Informat