Giampaolo Levorato
Giampaolo Levorato

Reputation: 1622

How to call a declared SAS parameter

I have declared a SAS parameter:

%let currentMonth = "June";

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

Upvotes: 0

Views: 30

Answers (2)

Richard
Richard

Reputation: 27508

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>

Upvotes: 1

Quentin
Quentin

Reputation: 6378

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 ;

Upvotes: 1

Related Questions