data testdeomo1;
retain id Disease_class ;
set testdemo;
if kindex(Disease_class,'癌症') thern y='癌症';
if kindex(Disease_class,'萎缩') thern y='萎缩';
if kindex(Disease_class,'浅表') thern y='浅表';
if kindex(Disease_class,'正常') thern y='正常';
run;
data testdeomo1;
retain id Disease_class ;
set testdemo;
if kindex(Disease_class,'癌症') then y='癌症';
if kindex(Disease_class,'萎缩') then y='萎缩';
if kindex(Disease_class,'浅表') then y='浅表';
if kindex(Disease_class,'正常') then y='正常';
run;
自己查了查,如下程序可以!!!
proc sql;
create table tentative2 as
select id, class,
case when class contains '癌症' then '癌症'
when class contains '肠化' then '肠化'
when class contains '萎缩' then '萎缩'
when class contains '浅表' then '浅表'
else '正常'
end as classnew
from tentative ;
quit;
proc print data = tentative2;
run;