Please consider this sample SAS macro code:
%MACRO reports;
%IF &SYSDAY = Monday %THEN %DO;
%END;
%MEND reports;
Does every single word inside the macro need to be prefixed with a %
? What exactly does the %
sign mean?
%
is a macro trigger, along with &
. It identifies the next symbol(s) as part of a macro language element. This might be a macro call (%reports();
), a macro statement (%if
), a macro comment (%*
), or other macro language elements.
Understanding how the SAS macro language works is pretty important to understanding the difference here. %IF
for example is instructing the SAS macro processor to do something. IF
is regular SAS code that will be put into the SAS data step (or whatever). Spend some time understanding what the macro language is doing - what the point of it is entirely - to fully understand that.
And, as with many things in SAS, Ian Whitlock can explain it better than I can.