null values show only the scope and name of the variable. Characters in values that have
been quoted with macro quoting functions remain quoted. Values that are too long for
the current line size wrap to the next line or lines. Macro variables are listed in order
from the current local macro variables outward to the global macro variables.
Note: Prior to SAS 9.4, within a particular scope, macro variables might appear in any
order. And the order might change in different executions of the %PUT statement or
in different SAS sessions. But beginning in SAS 9.4, the variables are always listed
alphabetically. However, automatic macro variables created in a SAS session might
differ depending on which SAS products are installed and the platform on which
SAS is running. Users are advised to refrain from writing code that depends on them
appearing in a predictable order.
The following figure shows the relationship of these terms.
Figure 19.1 %PUT Arguments by Type and Scope
The %PUT statement displays text in different colors to generate messages that look like
ERROR, NOTE, and WARNING messages generated by SAS. To display text in
different colors, the first word in the %PUT statement must be ERROR, NOTE, or
WARNING (all uppercase letters), followed immediately by a colon or a hyphen. You
might also use the national-language equivalents of these words. Using a hyphen (-)
following the ERROR, NOTE, or WARNING keyword causes the text of the %PUT
statement to be a continuation of the previous ERROR, NOTE, or WARNING message,
respectively. When you use a hyphen, the ERROR, NOTE, or WARNING word is
blanked out.
Note: If you use the %PUT statement and the last message text that was generated by
the SYSWARNINGTEXT and SYSERRORTEXT automatic macro variables
contained an & or %, you must use the %SUPERQ macro quoting function. For more
information, see
“SYSERRORTEXT Automatic Macro Variable” on page 211 and
“SYSWARNINGTEXT Automatic Macro Variable” on page 234.
T I P If you place an equal sign between the ampersand and the macro variable name
of a direct macro variable reference, the macro variable's name is displayed in the log
along with the macro variable's value.
%let x=1;
%put &=x;
X=1;
%PUT Statement 333