Manipulating Macro Variable Values with Macro Functions

When you define macro variables, you can include macro functions in the expressions to manipulate the value of the variable before the value is stored. For example, you can use functions that scan other values, evaluate arithmetic and logical expressions, and remove the significance of special characters such as unmatched quotation marks.
To scan for words in macro variable values, use the %SCAN function:
%let address=123 maple avenue;
%let frstword=%scan(&address,1);
The first %LET statement assigns the string 123 maple avenue to macro variable ADDRESS. The second %LET statement uses the %SCAN function to search the source (first argument) and retrieve the first word (second argument). Because the macro processor executes the %SCAN function before it stores the value, the value of FRSTWORD is the string 123.
For more information about %SCAN, see %SCAN and %QSCAN Functions. For more information about macro functions, see Macro Language Elements.