- 阅读权限
- 255
- 威望
- 1 级
- 论坛币
- 7113 个
- 通用积分
- 499.0346
- 学术水平
- 217 点
- 热心指数
- 220 点
- 信用等级
- 136 点
- 经验
- 15006 点
- 帖子
- 251
- 精华
- 1
- 在线时间
- 1698 小时
- 注册时间
- 2005-6-21
- 最后登录
- 2023-12-19
|
- data raw;
- input a :$20.;
- datalines;
- 66,02,03,01
- 77,01,04,02
- ;
- /*1*/
- data out1(index=(id=(row temp)));
- set raw;
- row=_n_;
- do i=1 to count(a,',')+1;
- temp=scan(a,i,',');
- output;
- end;
- run;
- data out1(drop=i row temp);
- length _a $100;
- do _n_=1 by 1 until(last.row);
- set out1;
- by row temp;
- _a=catx(',',_a,temp);
- end;
- run;
- /*2*/
- data out2(drop=i temp rc);
- length temp $10 _a $100;
- if _n_=1 then do;
- declare hash h(hashexp:2,ordered:'a');
- declare hiter hi('h');
- rc=h.definekey('temp');
- rc=h.definedata('temp');
- rc=h.definedone();
- end;
- set raw;
- do i=1 to count(a,',')+1;
- temp=scan(a,i,',');
- rc=h.add();
- end;
- call missing(temp);
- do until(hi.next() ne 0);
- _a=catx(',',_a,temp);
- end;
- rc=h.clear();
- run;
- /*3*/
- proc fcmp outlib=work.funcs.benfunc;
- function bensort(str $) $100;
- attrib out length=$100;
- array arr[9] $10;
- do i=1 to 9;
- arr[i]=scan(str,i,',');
- end;
- call sortc(arr1,arr2,arr3,arr4,arr5,arr6,arr7,arr8,arr9);
- do i=1 to 9;
- out=catx(',',out,arr[i]);
- end;
- return(out);
- endsub;
- run;
- options cmplib=work.funcs;
- data out3;
- set raw;
- length _a $100;
- _a=bensort(a);
- run;
复制代码
|
-
总评分: 经验 + 80
论坛币 + 80
学术水平 + 6
热心指数 + 6
信用等级 + 6
查看全部评分
|