SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
geoonline
Calcite | Level 5

Experts,

I was trying to mask single quotation mark in a SAS macro variable & was using %bquote to do that.

But using %bquote I was getting reolving issues especially when I use multiple '&' as in the example below. I was thinking that %bquote wouldn't mask '&' unlike %nrbquote. 

Say, in the below example:

%let MACVAR1=10;
%let a1=MACVAR1;

%let j=&a1;
%let k=%bquote(&a1);
%let m=%nrbquote(&a1);

%put "double_j = &&&j";

%put "double_k = &&&k";
%put "double_m = &&&m";

NOTE: Remote submit to SERVER commencing.

"double_j = 10"

"double_k = &MACVAR1"

"double_m = &MACVAR1"

NOTE: Remote submit to SERVER complete.

Reading through the SAS documentation I was expecting that double_k should also be resolved as 10 not "&MACVAR1" as we are using %bquote.

Experts, please correct me if I am wrong here. Please advise.

Regards,

   Geo

1 REPLY 1
jakarman
Barite | Level 11

macro quoting in a current SAS session is already terrible.  Using that in combination with sas/connect remote session (different machine types) is even more troublesome.  Please explain better you real issue / question this is far too fragmented.  (SAS versions?  OS types? goal?)

---->-- ja karman --<-----

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

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
  • 1 reply
  • 1745 views
  • 0 likes
  • 2 in conversation