The SET command recognizes several string functions and also supports several command options that do the same thing. The first six functions below are redundant with the command options so that simply means that you have alternative ways of accomplishing the same things. See examples below.
FUNCTIONS OPTIONS
------------- ----------
trim(s) -Trim trailing blanks. T - Trim trailing blanks.
ltrim(s) -Trim leading blanks. L - Trim leading blanks.
upper(s) -Convert to upper case. U - Convert to upper case.
lower(s) -Convert to lower case. L - Convert to lower case.
squeeze(s) -Remove excess blanks. M - Remove excess blanks.
proper(s) -Convert to proper noun. P - Convert to proper noun.
strlen(s) -Determine length of string.
The above list of options is not all of the SET options, it is showing only the ones that are function-redundant.
Examples:
set/tu %vv = %aa
Move the content of %aa to %vv but trim off any trailing blanks
and convert it to upper case.
set %vv = trim(upper(%aa))
Alternative expression that does the same as above.
set/pm %yy = %xx
Suppose %xx contained the value PATRICK BRENT. %yy would
become Patrick Brent (first character upper case, the rest lower
case for each word, and also excess blanks squeezed out).
set %yy = squeeze(proper(%xx))
Alternative expression that does the same as above.
set %csz = trim(proper(%city))!' '!upper(%state)!' '!%zip
Here we are taking information from three different variables
and connecting them together onto one with a single blank sep-
arating each value. Notice that we are applying different string
functions to each term of the expression. In this case there is
no use of options that will accomplish this same thing.
set/u %yy = %qq (2)
Suppose %qq contained the value abcde. The format override says just two characters, so %yy becomes AB.
set %aa = ' abc '
set/tlu %cc = %aa
The first SET establishes %aa as containing abc with 3 leading
and 3 trailing spaces. In the second SET %cc becomes ABC with
no leading or trailing spaces.
set %len = strlen("AAA")
%len becomes 3. (The length of the string AAA.)
set %cc= ' 20'
calc %nn=%cc*2
set %cc=%nn(+3)
This sequence illustrates The automatic conversion of a string
to a numeric and then converting the result of a calculation back
into a string. The CALC automatically converts the string ' 20'
(space 20) to a numeric, multiplies it by 2, and leaves the value
40.000 in the numeric variable %nn. Then, in the second SET, the
numeric is converted back into a string. The format override
(+3)
controls the conversion and ensures the result ' 40' (space 40).