我正在尝试在 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;
但它似乎不喜欢在连接之前添加一个连接。这是正确的方法吗,还是我错过了什么?
谢谢。