filename rawdata '~/simmat.dat'; data species; infile rawdata; input species t1-t16 #2 t17-t32; id=species*100+_N_; N=_N_; run; data similar (type=distance); array dist(43) d1-d43; retain d1-d43 .; do row=1 to 43; set species point=row; array tests(32) t1--t32; array save(32) save1-save32; do i=1 to 32; save(i)=tests(i); end; do col=1 to row; set species(drop=species) point=col; score=0; do i=1 to 32; if abs(tests(i)-save(i)) le 1 then score=score+1; end; dist(col)=1-score/32; end; output; end; stop; keep id d1-d43; run; proc print; run; proc cluster data=similar method=average pseudo outtree=tree; var d1-d43; id id; run; proc print;run; proc tree data=tree n=4; id id; run;