Chapter Contents

Previous

Next
$BINARYw.

$BINARYw.



Converts binary data to character data

Category: Character


Syntax
Syntax Description
Details
Comparisons
Examples

Syntax

$BINARYw.

Syntax Description

w
specifies the width of the input field. Because eight bits of binary information represent one character, every eight characters of input that $BINARYw. reads becomes one character value stored in a variable.

If w< 8, $BINARYw. reads the data as w characters followed by 0s. Thus, $BINARY4. reads the characters 0101 as 01010000, which converts to an EBCDIC & or an ASCII P. If w> 8 but is not a multiple of 8, $BINARYw. reads up to the largest multiple of 8 that is less than w before converting the data.
Default: 8
Range: 1-32767


Details

The $BINARYw. informat does not interpret actual binary data, but it converts a string of characters that contains only 0s or 1s as though it is actual binary information. Therefore, use only the character digits 1 and 0 in the input, with no embedded blanks. $BINARYw. ignores leading and trailing blanks.

To read representations of binary codes for unprintable characters, enter an ASCII or EBCDIC equivalent for a particular character as a string of 0s and 1s. The $BINARYw. informat converts the string to its equivalent character value.


Comparisons


Examples

input @1 name $binary16.;

Data Lines Results
----+----1----+----2
ASCII EBCDIC
0100110001001101
LM
<(


Chapter Contents

Previous

Next

Top of Page

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