ASCII: Returning the ASCII Code for the Leftmost Character in a String

How to:

ASCII takes a character string and returns the ASCII code in integer format for the leftmost character in the string.

Syntax: How to Return the ASCII Code for the Leftmost Character in a String

ASCII(charexp)

where:

charexp

Is any character string.

Example: Returning the ASCII Code for the Leftmost Character in a String

In the following request, ASCII returns the ASCII code for the leftmost character in the CATEGORY field.

TABLE FILE GGSALES
SUM DOLLARS NOPRINT
AND COMPUTE
ASCII_CODE/I9 = ASCII(CATEGORY);
BY CATEGORY
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.