SAS Enterprise Guide 对多个数据集使用 1 个查询
我想通过单个查询运行多个数据集(格式相同),并为每个输入的数据集生成输出。
SAS Enterprise Guide 中可以吗?
I want to run multiple data sets (that are in the same format) through a single query and for it to produce an output for each data set that is input.
Is the possible in SAS Enterprise Guide?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 EG 中的大多数任务,您可以右键单击它们并选择“选择输入数据...”,然后更改输入数据。过滤器和我假设您正在谈论的查询任务没有此选项。
我能想到的重用查询的唯一方法涉及深入研究 SAS 代码。如果您对此感到满意,这里有一个建议(这是在 EG4.1 中,我认为以后的版本是类似的):
使用过滤器的第一个数据集和
查询任务。
选择“添加为代码模板”。一个新的
代码对象将出现在
项目设计师。当你打开它时,
你会看到 SAS 代码
由过滤器构建查询任务。
将位于
from
子句中SQL代码)到不同的输入数据
设置并更改输出数据的名称(参见
将表 xxx 创建为
)。您还可以需要更改名称
在它说的地方输出数据
%_eg_conditional_dropds(xxx)
或类似 - 这部分正在删除
与您的数据集同名
输出数据(如果存在)。
这有点费力 - 如果您要做很多这样的事情,我建议您跳入 SAS 编码,因为有很多方法可以完成您所描述的事情,这比破解 EG 任务代码要容易得多:)
For most tasks in EG, you can right-click them and choose "Select Input Data...", and change the input data. The filter & query task, which I'm assuming you're talking about, does not have this option.
The only approaches I can think of to re-use a query involve delving into SAS code. If you're comfortable with this, here's one suggestion (this is in EG4.1, I presume later versions are similar):
first data set using the filter and
query task.
select "Add as code template". A new
code object will appear in the
project designer. When you open it,
you'll see the SAS code that was
built by the filter & query task.
will be in the
from
clause of theSQL code) to a different input data
set, and change the name of the output data (see
create table xxx as
). You may alsoneed to change the name of the
output data where it says
%_eg_conditional_dropds(xxx)
orsimilar - this part is dropping a
dataset with the same name as your
output data, if it exists.
It's all a bit laborious - if you're doing a lot of this, I suggest you hop into SAS coding, because there are lots of ways to do what you're describing that are much easier than hacking EG task code :)
编写 sas 代码以循环遍历数据集,对每个数据集执行 sql 并使用唯一标识符命名结果。点击世界并不有趣。
Write the sas code to loop through the datasets executing the sql on each one and naming the results with a unique identifier. Not fun the in point and click world.
不太确定一次需要运行多少数据集,但也许您可以使用动态提示?
http://www.google.com/url?sa=t&source=web&cd=1 & ;ved=0CBUQFjAA&url=http%3A%2F%2Fsupport.sas.com%2Fresources%2Fpapers%2Fproceedings10%2F041-2010.pdf&ei=khmjTeClJ4iCsQPV7PX5DA&usg=AFQjCNFatS3cbwYl5kCCpQUfqKYK3ndflQ& sig2=3ItVrgWXlegBzvjt4-rGAQ
或者,通过将所有数据集附加在一起,然后在到达报告方后分成不同的输出,从不同的角度攻击它......
Not too sure how many datasets you need to run this for at a time but perhaps you could use a dynamic prompt?
http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBUQFjAA&url=http%3A%2F%2Fsupport.sas.com%2Fresources%2Fpapers%2Fproceedings10%2F041-2010.pdf&ei=khmjTeClJ4iCsQPV7PX5DA&usg=AFQjCNFotS3cbwYl5kCCpQUfqKYK3ndflQ&sig2=3ItVrgWXlegBzvjt4-rGAQ
Alternatively, attack it from a different angle by appending all of the datasets together then split into the different outputs once you get to the reporting side...