经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
请有高见的大虾出来讨论和赐教!
- data test;
- input id $ name $ 14. age;
- cards;
- 001 张三,李四,王五 25
- 002 赵六,甲乙 30
- ;
- run;
- data test1;
- retain id age;
- set test;
- do i=1 to countc(name,',')+1;
- name1=scan(name,i,',');
- output;
- end;
- drop i name;
- run;
复制代码- data aa;
- input ID name $;
- cards;
- 1001 ABC
- 1002 ABCD
- 1003 ABCDE
- ;
- run;
- data bb;
- retain id;
- set aa;
- do i=1 to length(name);
- do j=i to length(name);
- name1=substr(name,i,j-i+1);
- output;
- end;
- end;
- drop i j name;
- run;
- proc sql;
- create table cc as
- select distinct a.id as id1, b.id as id2, count(a.name1=b.name1) as com
- from bb as a, bb as b
- where a.id<b.id and a.name1=b.name1
- group by a.id, b.id
- ;
- create table dd as
- select *,length(name) as len
- from aa
- ;
- create table ee as
- select a.id1, a.id2, b.len as len1, a.com
- from cc as a, dd as b
- where a.id1=b.id
- ;
- select a.id1, a.id2, a.len1, b.len as len2, a.com
- from ee as a, dd as b
- where a.id2=b.id
- ;
- quit;
复制代码
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|