%LEFT and %QLEFT Autocall Macro

Left-align an argument by removing leading blanks.
Type: Autocall macro
Requirement: MAUTOSOURCE system option

Syntax

%LEFT(text | text expression)
%QLEFT(text | text expression)

Details

Note: Autocall macros are included in a library supplied by SAS. This library might not be installed at your site or might be a site-specific version. If you cannot access this macro or if you want to find out if it is a site-specific version, see your on-site SAS support personnel. For more information, see Storing and Reusing Macros.
The LEFT macro and the QLEFT macro both left-align arguments by removing leading blanks. If the argument might contain a special character or mnemonic operator, listed below, use %QLEFT.
%LEFT returns an unquoted result, even if the argument is quoted. %QLEFT produces a result with the following special characters and mnemonic operators masked so the macro processor interprets them as text instead of as elements of the macro language:
& % ' " ( ) + − * / < > = ¬ ^ ~ ; , # blank
AND OR NOT EQ NE LE LT GE GT IN

Example: Contrasting %LEFT and %QLEFT

In this example, both the LEFT and QLEFT macros remove leading blanks. However, the QLEFT macro protects the leading & in the macro variable SYSDAY so it does not resolve.
%let d=%nrstr(   &sysday   );
%put *&d* *%qleft(&d)* *%left(&d)*;
The %PUT statement writes the following line to the SAS log:
*   &sysday    * *&sysday   * *Tuesday   *