sas中anyalnum函数Anyalnum函数的应用 Scanning a String from Left to Right;data _null_;string='Next = Last + 1';j=0;do until(j=0);j=anyalnum(string,j+1);if j=0 then put +3 "That's all";else do;c=substr(string,j,1);put +3 j= c=;end;end;run;The

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/07 21:22:13

sas中anyalnum函数Anyalnum函数的应用 Scanning a String from Left to Right;data _null_;string='Next = Last + 1';j=0;do until(j=0);j=anyalnum(string,j+1);if j=0 then put +3 "That's all";else do;c=substr(string,j,1);put +3 j= c=;end;end;run;The
sas中anyalnum函数
Anyalnum函数的应用 Scanning a String from Left to Right;
data _null_;
string='Next = Last + 1';
j=0;
do
until(j=0);
j=anyalnum(string,j+1);
if j=0 then put +3
"That's all";
else
do;
c=substr(string,j,1);
put +3
j= c=;
end;
end;
run;
The following lines are written to the SAS log:
j=1 c=N j=2 c=e j=3 c=x j=4 c=t j=8 c=L j=9 c=a j=10 c=s j=11 c=t j=15 c=1 That's all.
这个程序有点看不明白,为什么j后来会等0呢?

sas中anyalnum函数Anyalnum函数的应用 Scanning a String from Left to Right;data _null_;string='Next = Last + 1';j=0;do until(j=0);j=anyalnum(string,j+1);if j=0 then put +3 "That's all";else do;c=substr(string,j,1);put +3 j= c=;end;end;run;The
anyalnum(string, j+1)返回string中从j+1位置开始第一个字母或者数字的位置.当j+1的长度大于string的长度时,返回0,并赋值到j