>
数据之路 数据之路 820成员

22JUL10,scan &catt(mail)

木桶伯 2010-07-22
/* test data */
data one;
input @1 var $char10.;
cards;
154/A0038
68/A0022
01/A003
8/A0078
132/A001
;
run;

/* separate numb out and create 5-char id */
data two;
set one;
drop word1 word2;
word1 = scan(var, 1, '/');
word2 = scan(var, 2, '/');
length numb id $5;
numb = left(word1);
id = catt(substr(word2,1,1),
put(input(substr(word2,2),best.),z4.));
run;

/* check */
proc print data=two;
run;
/* on lst
Obs var numb id
1 154/A0038 154 A0038
2 68/A0022 68 A0022
3 01/A003 01 A0003
4 8/A0078 8 A0078
5 132/A001 132 A0001
*/
0

查看更多有趣的豆瓣小组

回应

还没人回应,我来添加

推荐小组

值得一读

    豆瓣
    我们的精神角落
    免费下载 iOS / Android 版客户端