BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DucatiJong
Calcite | Level 5

Hi,

 

I was creating a dynamic list of code string with semicolon and putting them on macro variables. When i try to verify these constructed statements, i found out that i could not print these as they contain semi colon. An example of my problem below,

 

data _null_;
call symputx('MyList','stuff with '||'&'||' and '||' ;'||' and some other stuffs');
run;

 

%put &=MyList;

 

Is there a way i could get around this? I dont have to use %put and my main purpose is to be able to review my list as my build is way more complicated that the example above.

 

Cheers for any help.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You can use macro quoting to allow the value to print without the macro processor trying to evaluate the semi-colon (or the & and % characters).

The %SUPERQ() macro function is a good way.

%put MYLIST=%superq(mylist);

 

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

You can use a Macro Quoting Function to get around this

 

%let MyList=%str(stuff with & and ; and some other stuffs);

%put &MyList;
Astounding
PROC Star
You can see the values assigned with:

%put _user_;

However those semicolons can still cause trouble when you try to use the variables in other ways.
Tom
Super User Tom
Super User

You can use macro quoting to allow the value to print without the macro processor trying to evaluate the semi-colon (or the & and % characters).

The %SUPERQ() macro function is a good way.

%put MYLIST=%superq(mylist);

 

DucatiJong
Calcite | Level 5

Thanks!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 2354 views
  • 0 likes
  • 4 in conversation