1. %if 语句中可以使用比较运算符;
2. 嵌套多了会降低编译效率,也不易发现错误。
%macro check(vt);
%do i=1 %to 3;
data _null_;
x= substr("&vt", &i,1);
y= rank(x);
call symput('tx',x);
call symput('ty',y);
run;
%if (&ty=82 or &ty=114) %then %let r=1;
%if (&ty=74 or &ty=106) %then %let j=1;
%if (&ty=89 or &ty=121) %then %let y=1;
%if (&ty=77 or &ty=109) %then %let m=1;
%put *--- The ASCII position of "%trim(&tx)" is %left(&ty) %str(---*);
%end;
%mend;
%check(Rjm);


雷达卡




京公网安备 11010802022788号







