全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
1962 4
2014-02-18
data test;
input x y;
cards;
1 2
1 3
1 4
2 3
2 4
2 8
3 4
;
run;

proc sql; create table test_a as select
a.x as x_a,  b.x as x_b, a.y
from test as a inner join test as b
on a.y=b.y and a.x<b.x;
quit;

二维码

扫码加我 拉你入群

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

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

全部回复
2014-2-18 12:46:12
复制代码
Test_wanted.JPG
二维码

扫码加我 拉你入群

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

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

2014-12-4 15:13:01
data test;
input x y;
cards;
1 2
1 3
1 4
2 3
2 4
2 8
3 4
;
run;

data a;
set test;
rename x=x_a;
run;
data b;
set test;
rename x=x_b;
run;
proc sort data =a ;
by y;
run;
proc sort data =b;
by y;
run;
data test_a ;
merge a (in =a)  b (in =b);
by y ;
if (a =1);
if   x_a < x_b;
run;
二维码

扫码加我 拉你入群

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

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

2014-12-5 23:01:42
复制代码
二维码

扫码加我 拉你入群

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

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

2014-12-6 22:49:49
Tigflanker 发表于 2014-12-5 23:01
貌似少了一条记录,改了下,哈哈
data final(drop=x);
        if 0 then set test;
        if _n_ = 1 then do;
                        dcl hash h(dataset:'test',multidata:'y');
                        h.definekey('y');
                        h.definedata(all:'y');
                        h.definedone();
        end;

        set test;

        x_a = x;

        if ~h.find() then do;
                if x_a < x then do;
                                                        x_b = x;
                                                        output;
                                                end;

                do while(~h.find_next() );
                        x_b = x;
                        if x_a < x_b then output;
                end;
        end;
run;
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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