Syntax Supported by the IML Procedure and the iml Action

BYTE Function

BYTE (matrix) ;

This function is supported by the IML procedure and the iml action.

The BYTE function returns values in a computer’s character set. The input to the function is a numeric matrix, each element of which specifies the position of a character in the computer’s character set. These numeric elements should generally be in the range 0 to 255. The BYTE function returns a character matrix with the same shape as the numeric argument.

For example, in the ASCII character set, the following two statements are equivalent:

a1 = byte(47);
a2 = "/";       /* the slash character */
print a1 a2;

Figure 24: Specifying the Slash Character

a1a2
//


The lowercase English letters can be generated with the following statement, shown in Figure 25:

y = byte(97:122);    /* or use "a":"z" */
print y;

Figure 25: Lowercase English Letters

y
abcdefghijklmnopqrstuvwxyz


The BYTE function simplifies the use of special characters and control sequences that cannot be entered directly into SAS/IML programs by using the keyboard. Consult the character set tables for your computer to determine the printable and control characters that are available and their ordinal positions.

Last updated: March 08, 2024