我在当前代码中有这个proc sql查询。不幸的是,我处理了超过1000万条记录,因此需要花费数小时才能运行。我一直试图将其转换为数据步骤,认为它会更快地运行。但是,我似乎无法获得相同的数据结果。如果有人可以帮助我完成数据步骤,我将非常感激。或者,如果您有关于如何使proc sql更有效地运行的建议。
这是我的proc sql查询:
proc sql;
create table test as
select *
from table1 a
where exists (select 1
from table2 b
where b.acct_id = a.acct_id);
quit;
这是我尝试将其转换为数据的步骤:
proc sort data=table1; by acct_id; run;
proc sort data=table2; by acct_id; run;
data test;
merge table1 (in=a)
table2 (in=b);
by acct_id;
if a and b;
run;