BookmarkSubscribeRSS Feed
TimurShangareev
Calcite | Level 5

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:

TimurShangareev_0-1675119602891.png

So that code runs:

TimurShangareev_1-1675119660491.png

But i still can't use any macro directive:

TimurShangareev_2-1675119744678.png

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) ).

4 REPLIES 4
SASKiwi
PROC Star

You could try the "magic string" several times testing if it works after each try.

;*';*";*/;quit;run;
Quentin
Super User

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.

 

 

Patrick
Opal | Level 21

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(&param);
%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. 

PaigeMiller
Diamond | Level 26

To avoid this issue in the future, please see the example here of having a single unmatched quote in a text string.

 

 

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1527 views
  • 5 likes
  • 5 in conversation