BookmarkSubscribeRSS Feed
u63406443
Calcite | Level 5

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:

 

u63406443_0-1698293433438.png

 

3 REPLIES 3
Tom
Super User Tom
Super User

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)
Patrick
Opal | Level 21

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

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 662 views
  • 1 like
  • 3 in conversation