It can be beneficial to write into the LOG values of a macro variable name and the stored value, particularly for LOCAL macro variables created inside a macro programme definition.
There has always been a shorthand method for writing dataset name / value pairs in to the LOG using the variable_name=
syntax:
data _null_ ; set sashelp.class (obs= 2) ; put name= ; run ;
giving a LOG containing the following:
Name=Alfred Name=Alice
To write out individual name / value pairs in the macro procesor required additional syntax, but since SAS version 9.3, adding an = after the ampersand will acheive the desired effect:
%macro countwords(text) ; %let wordcount = %sysfunc(countw(&text)) ; %put text = &text ; *** Additional syntax form *** ; %put &=wordcount ; *** Shorthand notation *** ; %mend countwords ; %countwords(Pink Chameleon)
as can be seen in the LOG:
text = Pink Chameleon WORDCOUNT=2