首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将SAS表与SQL直通合并

将SAS表与SQL直通合并
EN

Stack Overflow用户
提问于 2016-12-30 23:11:06
回答 0查看 692关注 0票数 0

我正在尝试合并SQL直通中的SAS表,以帮助减少查询SQL数据库所需的时间。目前,我只是使用直通,大约需要8-9个小时才能从表中提取所有内容,然后再选择我想要的内容。

目前,直通看起来像这样:

代码语言:javascript
运行
复制
proc sql;
    connect to ODBC as CAW(datasrc = "CAW_ULI_STATIC");
    create table test  as 
        select aelref, aelprdtyp, aelsubtyp, aelloc, aelopndte,
         hdscontrolopendate, hdscontrolclosedate, hdscontrolaction,
        from connection to CAW (
                                select aelref, aelprdtyp, aelsubtyp, aelloc, aelextnbr, aelbrnpfx, aelitnnbr, aelopndte,
                                         aelclddte, hdscontrolopendate, hdscontrolclosedate, hdscontrolaction
                                from PUBLIC_withpersonal_short.Vwhdscisagrmnt (nolock)

                                where HDSControlACTION <> 'D' 
                                    and aelsubtyp in (1, 2, 3, 4, 5, 10, 20, 21)
                                order by aelref, hdscontrolopendate, hdscontrolclosedate
                                ); 
disconnect from CAW;
; 
quit;

但我现在正在尝试使用另一个SAS数据集,通过执行左连接来缩小我从直通中提取的范围,因此它看起来如下所示:

代码语言:javascript
运行
复制
    proc sql;
        connect to ODBC as CAW(datasrc = "CAW_ULI_STATIC");
        create table test  as 
            select a.*, aelref, aelprdtyp, aelsubtyp, aelloc, aelopndte,
             hdscontrolopendate, hdscontrolclosedate, hdscontrolaction,
            from Import1 a left join connection to CAW (
                                    select aelref, aelprdtyp, aelsubtyp, aelloc, aelextnbr, aelbrnpfx, aelitnnbr, aelopndte,
                                             aelclddte, hdscontrolopendate, hdscontrolclosedate, hdscontrolaction
                                    from PUBLIC_withpersonal_short.Vwhdscisagrmnt (nolock)

                                    where HDSControlACTION <> 'D' 
                                        and aelsubtyp in (1, 2, 3, 4, 5, 10, 20, 21)
                                    order by aelref, hdscontrolopendate, hdscontrolclosedate
                                    ); 
    disconnect from CAW b;
    on a.ANUM = b.aelextnbr
    ; 
    quit;

但它似乎不像在连接之前添加连接。这是正确的方法吗,还是我漏掉了什么?

谢谢。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41398400

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档