Hi, Cynthia,
Thanks for your posting, I learned much from it. However, I am unable to follow this step:
"break up the string: &&out &previtem &&y".
Is there any particular reason to break the string in this way? I carefully read your explanation about the forward scan rule and the rescan rule and I think neither the forward scan rule and the rescan rule implies it. For example, let's consider the following code:
%let d = one;
%put &&&&d;
For this case, how should I perform the step: break up the string? There seem no clear boundaries as the first example we can break the string up.
The below is my own understanding, please correct me if it is wrong: It seems that at one time, from left to right, SAS tries to resolve all the macro variables indicated by & simultaneously, so for the first example &&out&previtem&&y, in the first attempt (scan), SAS resolves "&&", "&previtem", and "&&" to "&", "1" and "&" respectively, while keeping "out" and "y" unchanged, producing
"&out1&y",
then starts the second scan. At this time, there are two and only two macro variables &out1 and &y, and will be resolved to "ay1". In
"ay1", no macro variable is detected, so the resolve procedure ends.
In my example "&&&&d", in the first scan, SAS resolves "&&" and "&&" to "&" and "&", leaving "&&d" for the second scan, which resolves to "&d", and finally "one".
Thanks again for your time.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.