'how to reference a macro list in a filter of sas query editor
Hello Stackoverflow community.
I need to insert a filter into SAS Enterprise Guide query builder.
This filter should contain a huge list of product codes, the format of this column is a character, but it's very time consuming to insert them one by one into the filter section using the IN operator.
So I was thinking to create a sas macrovariable, and referencing it into the filter of the query builder. Below an example
%LET product_codes =
'815001004490'
'815300465351',
'815100001069',
'815000000152',
'815100000561'
;
I wrote a proc sql to check if the program was giving me back results, and I got what I was expecting
proc sql;
create table want as
select * from library_name.table_name
where product in (&product_codes.)
;
quit;
However, when I repeat the same process in SAS query editor, then I get back an empty table.
I guess I am missing something. I am aware that the macrovariable works as simple text generator. How can this be resolved? any ideas? what am I doing wrong.
Solution 1:[1]
I found out what was the problem.
When I add a filter in SAS query editor, there is a little box below which asks to include or not values between double quotes. by doing that, I came out with a result from my query editor
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Enrico |