hamsik11 发表于 2013-8-7 21:58
高手 谢谢,不过还有问题啊,譬如“Andy”列,按照数据,Andy只跟kim,tom,paull三个直接联结,加上对角 ...
下标表示的有点问题,这样应该就没问题了:
proc iml;
use name_id;
read all var {name} into name;
close name_id;
use name_id2;
read all var{id1,id2} into id;
close name_id2;
res=j(nrow(name),nrow(name),0);
do i=1 to nrow(name);
res[id[i,1],id[i,2]]=1;
end;
create want from res[rowname=name colname=name];
append from res[rowname=name];
quit;