They differ by the number of ampersands preceding the macro variable.
Right, but among the 6 in your post, #1 is identical to #4, and #2 is identical to #5, and #3 is identical to #6.
Agreed. they are the same to me too.
I have no idea, anymore, of what I had attempted to post back then. It appears that the discussion was whether periods after a macro variable would cause the variable not to be resolved. However, my example didn't correctly show that and, in fact, was confusing to say the least.
I just ran the following and they both appear to run correctly whether they do or don't include periods:
%let i=2;
%let name=acct_num;
/* All of the following work */
data x;
acct_num2=12345;
put &&name&&i;
run;
data x;
acct_num2=12345;
put &&name&&i.;
run;
data x;
acct_num2=12345;
put &&name.&&i;
run;
data x;
acct_num2=12345;
put &&name.&&i.;
run;
Am I missing something? Those two sets of 3 data steps look the same to me.
remove double quote.
put &&name&i. ;
Hi Steve
among these responses, has someone suggested placing an = at the end?
Instead of
put "&&name&i.";
try
data ;
acct_num=123456789 ;
put &&name&i=;
run ;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.