SAS可以通过select语句完成多个选择条件的判断。基本格式:
select;
when(表达式) sas 语句;
.....
end;
如下:如果数据集cm中的变量cmenrtpt取ONGOING,则cmenrtpt赋值为Yes;如果不满足则进行下一句,再不满足就otherwise;
data a
set sdtm.cm;
select;
when(cmenrtpt='ONGOING') cmenrtpt='Yes';
otherwise cmenrtpt='No';
end;
run;
proc print data=a(obs=4);
run
;