Chapter Contents

Previous

Next
IBw.d

IBw.d



Reads integer binary (fixed-point) data

Category numeric
Width range: 1-8
Default width: 4
Decimal range: 0-10
Windows specifics: native floating-point representation


Syntax
Details
Comparison of IB and PIB
Example
See Also

Syntax

IBw.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

For integer binary data, the high-order bit is the value's sign: 0 for positive values, 1 for negative. Negative values are represented in twos-complement notation. If the informat includes a d value, the data value is divided by 10d.

Using the IBw.d informat requires you to understand twos complements and byte-swapped data format.

For more information about microcomputer fixed-point values, see Intel Corporation's i486 Microprocessor Programmer's Reference Manual.


Comparison of IB and PIB

The IBw.d informat and the PIBw.d informat give you different results. The IBw.d informat processes both positive and negative numbers and it 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 that your data contain the following 6-byte (byte-swapped) value:

64 00 00 00 00 00

If you read this value using the IB6. informat, it is read as the fixed-point value 100.0. Now suppose that your data contain the following (byte-swapped) value:

01 80
Because the sign bit is set, the value is read as -32,767.

See Also


Chapter Contents

Previous

Next

Top of Page

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