Depending on what characters you want to pass as a macro parameter value, you might need to use different SAS macro functions that provide "character masking". These macro functions are collectively called macro quoting functions. There are 7 of them, each has its own set of characters they mask, and the sets of those characters overlap between them. They also differ by their timing: A) macro compilation; or B) macro execution. You use macro compilation functions to mask characters in a string constants not containing & % or mnemonics (GT EQ OR AND etc). And you use macro execution functions otherwise.
Here are the 7 macro quoting functions:
A) Work at macro compilation
B) Work at macro execution
%QUOTE() and %NRQUOTE(), %BQUOTE() and %NRBQUOTE(), and %SUPERQ().
I use "pass them inside the box" analogy to explain how they work in my recent blog post Passing comma-delimited values into SAS macros and macro functions.
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!
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.