楼主: bhfly
4720 35

求助,数据的完全组合 [推广有奖]

11
bhfly 发表于 2015-2-6 17:48:29
wpfwxn 发表于 2015-2-6 14:41
数据导入过程省略,直接用sql过程的话,可以这样写:
proc sql noprint;
    create table newdata as
...
会出现磁盘已满的提示。。。怎么办?

12
mingfeng07 学生认证  发表于 2015-2-6 22:11:57
  1. proc import out=a file="C:\Users\mingfeng07\Desktop\组合0206.xls" dbms=excel replace;
  2. getnames=yes;
  3. run;
  4. proc sort data=a;by indyear;run;
  5. data b;
  6. set a;
  7. by indyear;
  8. where missing(code)^=1 and missing(indyear)^=1;
  9. if first.indyear then sum=0;
  10. else sum+1;
  11. run;
  12. proc sql;
  13. create table c as select b.indyear,b.code,b1.code as code1,catx('_',b.code,b1.code) as newcode from b,b as b1
  14.                   where b.indyear=b1.indyear and b.sum<b1.sum;
  15. quit;
复制代码
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
bhfly + 1 + 1 + 1 分析的有道理
teqel + 2 + 2 + 2 精彩帖子

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

13
teqel 发表于 2015-2-7 11:50:05
mingfeng07 发表于 2015-2-6 22:11
这个组合实现的很有意思。不过是不是直接用b.code<b1.code就行了?

14
mingfeng07 学生认证  发表于 2015-2-7 13:12:46
teqel 发表于 2015-2-7 11:50
这个组合实现的很有意思。不过是不是直接用b.code
恩,有道理,那在排序的时候by indyear code就好。

15
teqel 发表于 2015-2-7 13:18:48
mingfeng07 发表于 2015-2-7 13:12
恩,有道理,那在排序的时候by indyear code就好。
sql不用排序也行吧?

16
mingfeng07 学生认证  发表于 2015-2-7 13:29:46
teqel 发表于 2015-2-7 13:18
sql不用排序也行吧?
是的,我习惯排序了。。。

17
bhfly 发表于 2015-2-7 22:59:39
mingfeng07 发表于 2015-2-6 22:11
谢谢你!!!

18
bhfly 发表于 2015-2-7 23:01:23
wpfwxn 发表于 2015-2-6 14:38
看了下你的数据,比较大,用sql过程估计比较慢,用format可能会快一些
呵呵。。。跑了19个小时!!!

19
teqel 发表于 2015-2-7 23:06:46 来自手机
排完序会不会快点,还是说一样的时间?用set statement 写一个macro循环会不会快一点?

20
bhfly 发表于 2015-2-7 23:07:59
teqel 发表于 2015-2-7 23:06
排完序会不会快点,还是说一样的时间?用set statement 写一个macro循环会不会快一点?
可能会吧。。。可是我太菜鸟了。。。不会。。。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-25 15:06