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?
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');
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');
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.