It works because the macro call has caused the macro parser to treat the && and your macro call as two separate tokens. Normally if you type &&p1 the macro processor will convert && to & and then continue to resolve the token and try to resolve &p1. But adding the macro call around p1 it does not do that second round of evaluation. So the &p1 is passed into the macro as the value of P2.
Note that you should use the %UPCASE() function instead of calling the SAS supplied %LOWCASE() macro.
Use %UPCASE() instead because that is macro function (part of the actual SAS language).
Also the SAS supplied macro %LOWCASE is not that well written. It will cause errors if try to call it with values that contain commas.
567 %put %lowcase(a,b);
ERROR: More positional parameters found than defined.
Here is a replacement for the limited %LOWCASE() macro that SAS sends.
%macro lowcase/parmbuff;
%if %length(&syspbuff)>2 %then %sysfunc(lowcase&syspbuff);
%mend;
570 %macro lowcase/parmbuff;
571 %if %length(&syspbuff)>2 %then %sysfunc(lowcase&syspbuff);
572 %mend;
573
574
575 %put %lowcase;
576 %put %lowcase();
577 %put %lowcase(a,b);
a,b
... View more