如何使用 Proc SQL 查找仅存在于一个表中而不存在于另一个表中的所有记录? [英] How can I use Proc SQL to find all the records that only exist in one table but not the other?
本文介绍了如何使用 Proc SQL 查找仅存在于一个表中而不存在于另一个表中的所有记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在企业指南中使用任务执行此操作,否则我将只使用数据步骤.
I'm trying to do this in Enterprise Guide, with a task, otherwise I would just use a data step.
在数据步骤中,这将是:
In a data step, this would be:
data names;
input name $;
datalines;
John
Mary
Sally
Fred
Paul
;
run;
data check;
input name $;
datalines;
Mary
Fred
;
Proc sort data=names; by name; run;
Proc sort data=check; by name; run;
Data work.not_in_check;
merge names(in=n) check(in=c);
by name;
if n and not c;
run;
推荐答案
这是一种方法.肯定还有很多其他的.
Here's one way. There are surely many others.
proc sql;
create table not_in_check as
select name
from names
where name not in (select name from check);
quit;
这篇关于如何使用 Proc SQL 查找仅存在于一个表中而不存在于另一个表中的所有记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文