Chapter Contents

Previous

Next
PIBw.d

PIBw.d



Reads positive integer binary (fixed-point) data

Category numeric
Width range: 1-8
Default width: 1
Decimal range: 0-10
Windows specifics: native byte-swapped integers


Syntax
Details
Comparison of PIB and IB
Example
See Also

Syntax

PIBw.d

w
specifies the width of the input field.

d
optionally specifies the power of 10 by which to divide the input value. SAS uses the d value even if the input data contain decimal points.


Details

Positive integer binary values are the same as integer binary (see the informat IBw.d), except that all values are treated as positive. Thus, the high-order bit is part of the value rather than the value's sign.


Comparison of PIB and IB

The PIBw.d informat and the IBw.d informat give you different results, and you should differentiate carefully between these two informats. The IBw.d informat processes both positive and negative numbers and uses the high-order bit as the sign bit. In contrast, the PIBw.d informat is used only for positive numbers and it does not look for a sign bit. As an example, suppose your data contain the following two-byte (byte-swapped) value:

01 80

When you read this value using the IB2. informat, the informat looks for the sign bit, sees that it is on, and reads the value as -32,767. However, if you read this value with the PIB2. informat, no sign bit is used, and the result is 32,769.


Example

Suppose your data contain the following one-byte value:

FF

If you read this value using the PIB1. informat, it is read as the double-precision value 255.0. Using this informat requires you to understand twos complements and byte-swapped data format.

See Also


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.