sas(将数组转化为矩阵)

/*数组表*/ data a; input name $ other $; cards; a b a c a d b a b d b f c b c d c a c e d c d a d e d f e b e d f a f c f b a f ; /*排序*/ proc sort data=https://www.it610.com/article/a out=c; by name other; run; /*复制表*/ data b; input name2 $ other2 $; cards; a b a c a d b a b d b f c b c d c a c e d c d a d e d f e b e d f a f c f b a f ; /*排序*/ proc sort data=b out=d; by name2 other2; run; /*选择双向相关的数组*/ proc SQL; create table cccc as select distinct a.name,a.other from a,b where a.other=b.name2 and a.name=b.other2; run; data m; set cccc; d=1; run; /*利用转置过程*/ proc transpose data=m out=n(rename=(_name_=other)); var d; by name; id other; label other=; run; proc contents data=n out=p; run; proc sql; select name into:var separated by','from p where name not like 'name' ; create table x as select name,&var from n; quit; data u; set x; drop other; run;

【sas(将数组转化为矩阵)】还有一个在知乎上问过的相关问题:
https://www.zhihu.com/question/46338489?from=profile_question_card
两个问题相互补充,很适合做社会网络分析

    推荐阅读