全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
4105 4
2015-01-05
有两个数据集,如下:
data test;
input cust_id x y;
cards;
1 1 2
2 3 4
3 3 3
4 1 3
;
run;
data test1;
input cust_id x y;
cards;
1 1 2
2 1 3
2 3 5
5 3 4
6 3 3
;
run;

要实现,在数据集test1中选出变量 cust_id 和 x 都不在test中的观测,需要得到的结果集如下。
2 1 3
5 3 4
6 3 3

我尝试了以下代码:
proc sql;
  create table work.new as
  select * from test1
  where test1.cust_id not in (select cust_id from test)
  ;
quit;
这样只是在对cust_id进行判断。
请问,如何能把变量x的判断也加入where条件呢?
where test1.cust_id not in (select cust_id from test) and test1.x not in (select x from test)
这个条件不对啊????????
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-1-5 22:31:56
复制代码
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-5 23:57:42
sushe1527 发表于 2015-1-5 22:31
很好的程序,赞
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-6 11:12:17
谢谢,谢谢!很好的程序
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-6 11:13:56
谢谢sushe1527
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群