Writes real binary data (floating-point) in real binary format.
-
w
-
specifies the width of the output field.
-
d
-
specifies to multiply the number by 10d. This argument is optional.
The RBw.d format writes numeric data in the same way that SAS stores
them. Because it requires no data conversion, RBw.d is the most efficient method for writing data with
SAS.
Note: Different operating environments store real binary values
in different ways. However, RBw.d writes real binary values with consistent results in the
same type of operating environment that you use to run SAS. ![[cautionend]](../../../../common/63294/HTML/default/images/cautend.gif)
- CAUTION:
- Using RB4. to write real binary data on equipment that conforms
to the IEEE standard for floating-point numbers results in a truncated eight-byte
(double-precision) number rather than a true four-byte (single-precision)
floating-point number.
![[cautionend]](../../../../common/63294/HTML/default/images/cautend.gif)
The following table compares the names
of real binary notation in several programming languages:
Language |
4 Bytes |
8 Bytes |
SAS |
RB4. |
RB8. |
Fortran |
REAL*4 |
REAL*8 |
C |
float |
double |
COBOL |
COMP-1 |
COMP-2 |
IBM 370 assembler |
E |
D |
y=put(x,rb8.);
put y $hex16.;
Value of x |
Results |
|
----+---1----+----2
|
128
|
4280000000000000
|
*
The result is a hexadecimal representation of an eight-byte
real binary number as it looks on an IBM mainframe. Each byte occupies one
column of the output field. |
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.