SAS tranwrd函数、translate函数

1.tranwrd函数:将字符串中的某些字符替换为其他字符。

data _null_;
a='aabccdbce';
b=tranwrd(a,'bc','fff');
put a= b=;
run;

在log中得到如下结果:

a=aabccdbce b=aafffcdfffe

2.translate函数:变换字符串中字符的顺序,或者替换字符。

data _null_;
a='abcde';
b = translate('13254', a, '12345');
put a= b=;
run;

在log中得到如下结果:

a=abcde b=acbed

data _null_;
A='8/14/2010';
B=translate(a,'-','/');
put B=;
run;

在log中得到如下结果:

B=8-14-2010

全部评论

相关推荐

06-27 15:29
门头沟学院 Java
点赞 评论 收藏
分享
05-19 19:57
蚌埠学院 Python
2237:Gpa70不算高,建议只写排名,个人技能不在多而在精,缩到8条以内。项目留一个含金量高的,减少间距弄到一页,硕士简历也就一页,本科不要写很多
点赞 评论 收藏
分享
自由水:笑死了,敢这么面试不敢让别人说
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务