This tutorial explains how single (&), double (&&) and Triple (&&&) ampersand macro variables are resolved.
The scanner reads from left to right.
%let x=temp;Check how multiple ampersand macro variables work -
%let temp3 = result2;
- &x&n : Macro variable X resolves first to temp and then N resolves to 3. Output : temp3
- &&x&n : Two ampersands (&&) resolves to one ampersand (&) and scanner continues and then N resolves to 3 and then &x3 resolves to result. Output : result
- &&&x&n : First two ampersands (&&) resolves to & and then X resolves to temp and then N resolves to 3. In last, &temp3 resolves to result2. Output : result2