如何在SAS查询编辑器的过滤器中引用宏列表

发布于 2025-01-28 07:15:01 字数 753 浏览 2 评论 0原文

您好Stackoverflow社区。

我需要将过滤器插入SAS Enterprise Guide查询构建器中。

该过滤器应包含大量产品代码的列表,该列的格式是一个字符,但是使用IN Operator将它们一一插入过滤器部分非常耗时。

因此,我正在考虑创建一个SAS大型,并将其引用到查询构建器的过滤器中。在一个示例下,

%LET product_codes = 
'815001004490'
'815300465351',
'815100001069',
'815000000152',
'815100000561'
;

我写了一个Proc SQL来检查程序是否给了我退回结果,但是我得到了我期望的

proc sql;
create table want as 
select * from library_name.table_name
where product in (&product_codes.)
;
quit;

,但是,当我在SAS查询编辑器中重复相同的过程时,我会拿回一个空表。

我想我缺少一些东西。我知道大型可作为简单的文本生成器。如何解决?有什么想法吗?我在做什么错。

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.
enter image description here

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

歌枕肩 2025-02-04 07:15:01

我发现了什么问题。

当我在SAS查询编辑器中添加过滤器时,下面有一个小框,要求在双引号之间包括或不包括值。通过这样做,我从查询编辑器的结果中出来

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文