BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ammarhm
Lapis Lazuli | Level 10

I am trying to pass a string using a macro variable to an oracle server to extract data. The string will serve as a Where string. THe final product should be passed to the Oracle server like this

 

Select *
from DB
where column in ('A', 'B')
quit
;

However, i need the column variable to be passed in using a macro variable. Here is what I am trying to solve it:

 

%let column="('A','B')";
Select *
from DB
where column in %bquote(&column)
quit
;


This is however generating an error, which is mostly related to the quotes I think. I tried %unquote but no luck.

Anyone has a solution to this please?

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Why are wrapping your macro variable with double quotes

I don't think this 

%let column="('A','B')";

is needed.

 

 

 

The following should suffice

%let column=('A','B');

 

 

 

View solution in original post

1 REPLY 1
novinosrin
Tourmaline | Level 20

Why are wrapping your macro variable with double quotes

I don't think this 

%let column="('A','B')";

is needed.

 

 

 

The following should suffice

%let column=('A','B');

 

 

 

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