&SUBSTR()

The &SUBSTR() function obtains a substring of another string, starting at a specified position and obtaining either the remainder of the string a specified number of characters.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-&SUBSTR(-+--------+-,--position--+-----------+--+--------+--->
            '-string-'              '-,--length-'  '-,--pad-'   

>--)-----------------------------------------------------------><

string
The string of characters to be processed. This can be a null parameter.
position
The starting position within the string from which to obtain the resulting value. It must be a positive integer. The position parameter can be an expression and will be automatically evaluated using the &EVAL() function. This parameter is required.
length
The length of the resulting string. It must be a positive integer or zero. The length parameter can be an expression and will be automatically evaluated using the &EVAL() function (&EVAL()). The default length is to return the remainder of the string. This parameter is optional.
pad
A single character used to extend the resulting string to the required length when the remaining length of string is less than length. The default pad character is a blank. This parameter is optional.

Examples

&SUBSTR(&DATE,5,2)