I have a question on an exam paper which asks what is read in the SAS log
%let test=one;
%let one=two;
%let two=three;
%let three=last;
%put what displays is &&&&&test;
I was very surprised to find the answer was: two as I would have thought that this reference would fully resolve to last. SAS also agrees with the answer to be two.
Can anyone please explain how SAS arrives at the answer two as all theory notes I have read suggests that the macro processor should do the following
- scan1 &&&&&test - > &&&&test ( i.e && resolves to & and tells processor to continue to scan from right to left)
- scan2 &&&&test - > &&&one
- scan3 &&&one - > &&two
- scan4 &&two - > &three
- scan5 &three - > last