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

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

Return the ASCII Code for the Leftmost Character in a String

ASCII(charexp)

where:

charexp

Is any character string.

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.

ASCII returns the ASCII code of the leftmost character of CATEGORY.

ASCII(CATEGORY)

For Coffee, the result is 67.