I wrote macro function:
%macro libr;
%put %str(parameter's value);
%mend;
And its destroyed my log: I changed %str to %bquote, but now no one of macro functions doesn't work.
Next I runed this code:
So that code runs:
But i still can't use any macro directive:
How I can fix that without closing SAS IDE?
(if i close it, i won't be able to start SAS for other reasons (not for this topic) ).
You could try the "magic string" several times testing if it works after each try.
;*';*";*/;quit;run;
I played with it.
I think you need a single quote, and closing parenthesis, and a %mend.
I would submit:
*' ; *) ; %mend ;
A few times. If you get the error message:
ERROR: No matching %MACRO statement for this %MEND statement.
That indicates you are likely unstuck.
I normally use %nrbquote() ...but for your case %bquote() should also do the job.
data _null_;
call symputx('param',"parameter's value");
run;
%macro libr();
%put XXX %nrbquote(¶m);
%mend;
%libr();
To really provide you with a solution you would need to show us exactly how the macro variable gets populated and how you intend to use the macro.
If it's not a function style macro then you could also always use a data _null_ step, use symget() to get the macro value and then a normal SAS data step put/putlog to print the value to the log.
To avoid this issue in the future, please see the example here of having a single unmatched quote in a text string.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.