数据如图所示,a b c三个变量为肿瘤的定性变量,1,3分别代表恶性和不清楚,2代表良性,a1 b1 c1分别是肿瘤部位,附在a b c之后。我想新生成一个变量d,只挑出a b c是1或者3的,
d的值汇总该观测所有恶性和不清楚的肿瘤。第一个人就是“乳腺(1)”,第二个人是“肾(1)”,第三个人是“大脑(1)&乳腺(3)”,这个程序怎么写?
data a(drop=d1 d2 d3)
if a in(1,3) then d1=compress('"'||a1||'('||a||')'||'"');
if b in(1,3) then d2=compress('"'||b1||'('||b||')'||'"');
if c in(1,3) then d3=compress('"'||c1||'('||c||')'||'"');
d=catx('&',d1,d2,d3);
stormhoof 发表于 2012-8-17 17:42
data a(drop=d1 d2 d3)
if a in(1,3) then d1=compress('"'||a1||'('||a||')'||'"');
if b in(1,3) then ...
data e;
set ****;
informat dex $10.;
array tumor(3) a b c;
array dep(3) $ a1 b1 c1;
retain dex;
do i=1 to 3;
if tumor(i) in (1,3) then dex=dex||strip(dep(i))||strip(tumor(i));
end;
run;