11-20-2017 05:27 PM
I have a macro with multiple quotation marks. For example,
%let animal = 'cow', 'pig', 'chicken'
I want to use the macro animal in the WHERE clause in a proc sql pass-through query. How do I do that?
I already tried bquote and str but it doesn't seem to work.
11-20-2017 05:59 PM
You don't need any functions. Anywhere in the program where this would be valid syntax:
'cow', 'pig', 'chicken'
just insert &ANIMAL at that point.
11-20-2017 06:04 PM - edited 11-20-2017 06:05 PM
Did you try it? What problem did you have?
%let animal = 'cow', 'pig', 'chicken' ; proc sql ; connect to oracle as mydb ..... ; select * from connection to mydb (select * from have where animal in (&animal) ); quit;