Previous Page | Next Page

Macro Variables

Displaying Macro Variable Values

The simplest way to display macro variable values is to use the %PUT statement, which writes text to the SAS log. For example, the following statements write the following result:

%let a=first;
%let b=macro variable;
%put &a ***&b***;

Here is the result:

first ***macro variable***

You can also use a %PUT Statement to view available macro variables. %PUT provides several options that enable you to view individual categories of macro variables.

The system option SYMBOLGEN displays the resolution of macro variables. For this example, assume that macro variables PROC and DSET have the values GPLOT and SASUSER.HOUSES, respectively.

options symbolgen;
title "%upcase(&proc) of %upcase(&dset)";

The SYMBOLGEN option prints to the log:

SYMBOLGEN:  Macro variable PROC resolves to gplot
SYMBOLGEN:  Macro variable DSET resolves to sasuser.houses

For more information about debugging macro programs, see Macro Facility Error Messages and Debugging.

Previous Page | Next Page | Top of Page