How to call a declared SAS parameter

30 views Asked by At

I have declared a SAS parameter:

%let currentMonth = "June";

How do I print it out / find out what the value of currentMonth is ?

2

There are 2 answers

0
Quentin On BEST ANSWER

This is a SAS macro variable, not a parameter. There are many ways to diesplay the value of a macro variable, the easiest is with a %PUT statement:

%put The macro variable CurrentMonth has value: &CurrentMonth ;
0
Richard On

A useful statement is to create a log message that can be processed by a log viewer or log parser. Four special prefixes of a log line are INFO: NOTE: WARNING: and ERROR:. If you are logging a macro variable in the context of a macro, the macro name is also useful.

Example:

%macro xyzzy ;
  %put NOTE: &SYSMACRONAME: &=CurrentMonth ;
%mend ;
%xyzzy

will log

NOTE: XYZZY: CurrentMonth="June" ;

The macro syntax &=<symbol> will log <symbol>=<value-of-symbol>