我正在尝试合并SQL直通中的SAS表,以帮助减少查询SQL数据库所需的时间。目前,我只是使用直通,大约需要8-9个小时才能从表中提取所有内容,然后再选择我想要的内容。
目前,直通看起来像这样:
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数据集,通过执行左连接来缩小我从直通中提取的范围,因此它看起来如下所示:
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;
但它似乎不像在连接之前添加连接。这是正确的方法吗,还是我漏掉了什么?
谢谢。
https://stackoverflow.com/questions/41398400
复制相似问题