Hi All,
I am try to declare a macro variable and print the macro variable in log window using the put statement, but output is not fetching. Can you help me.
Attaching the output image for reference.
Code:
%let pass=%str(rAk%B25%);
%put &pass;
Thanks.
Result:
Do you actually have the %B25 macro that you are trying to call? What does it do?
Perhaps you meant to use %NRSTR()? if so double the % characters to mask them.
1 %let pass=%nrstr(rAk%%B25%%); 2 %put &pass; rAk%B25%
Your code it probably still looking for the closing ), right parenthesis, since you masked the one in the first line by prefixing it with a % character.
1 %let pass=%str(rAk%B25%); 2 %put &pass; 3 ); WARNING: Apparent invocation of macro B25 not resolved. ERROR: Open code statement recursion detected.
Add the closing ) to your %LET.
1 %let pass=%str(rAk%B25%)); WARNING: Apparent invocation of macro B25 not resolved. 2 %put &pass; WARNING: Apparent invocation of macro B25 not resolved. rAk%B25)
Thank you Tom.
The macro tokens like % complicate things a bit. %superq should help.
data _null_;
call symput('pass','rAk%B25%');
run;
%put %%SUPERQ(pass);
Deciding When to Use a Macro Quoting Function and Which Function to Use
Calling all data scientists and open-source enthusiasts! Want to solve real problems that impact your company or the world? Register to hack by August 31st!
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.