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