This tutorial explains how single (&), double (&&) and Triple (&&&) ampersand macro variables are resolved.
Example
The scanner reads from left to right.
Example
%let x=temp;Check how multiple ampersand macro variables work -
%let n=3;
%let x3=result;
%let temp3 = result2;
%put &x&n;
%put &&x&n;
%put &&&x&n;
Rule :
- &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
good explantation
ReplyDeleteThank you for stopping by my blog!
Deletenice explanation
ReplyDeleteThank you for your feedback.
DeleteVery well Explained..Thanks.
ReplyDeletewell explained...thank you
ReplyDeleteGreat explanation (Y)
ReplyDeleteGreat explanation (Y)
ReplyDeleteGreat stuff...keep posting
ReplyDeleteVery good stuff, really helps me a lot! Thank you very much!
ReplyDeleteGreat explanation! Thank you!
ReplyDeleteamazing explanation. totally appreciate you effort i building these examples. Hats off.
ReplyDeletewhat if I have &&&&&&&&&x&n ? can you please explain ?
ReplyDelete&&&&&&&&&x&n will give you result2
DeleteWell explained.
ReplyDeleteCrystal Clear..!!
ReplyDeletevery good explanation
ReplyDeletesuccinct and clear. Well done.
ReplyDeleteClear
ReplyDeleteVery well Explained...Really appreciate your efforts!!
ReplyDeleteJust have one question:
I didn't get in which situation double and triple ampersand is used.
I mean,
Why to use double or triple ampersand to get value of another variable? if it is possible to get value of particular variable using varname and single ampersand.
Good explanation
ReplyDelete