How to: |
Given a source character string, or an expression that can be converted to varchar (variable-length alphanumeric), and an integer number, RIGHT returns that number of characters from the right end of the string.
RIGHT(chr_exp, int_exp)
where:
Alphanumeric or an expression that can be converted to variable-length alphanumeric.
Is the source character string.
Integer
Is the number of characters to be returned.
The following request computes the length of the last name in the FULLNAME field and returns that number of characters to LAST.
TABLE FILE WF_RETAIL_EMPLOYEE PRINT FULLNAME AND COMPUTE LEN/I5 = ARGLEN(54, GET_TOKEN(FULLNAME, ' ', 2), LEN); NOPRINT COMPUTE LAST/A20 = RIGHT(FULLNAME, LEN); WHERE RECORDLIMIT EQ 20 ON TABLE SET PAGE NOLEAD ON TABLE SET STYLE * GRID=OFF,$ ENDSTYLE END
The output is shown in the following image.