Hi, addressing just the "in common" question (as in "Groups 6 &7 have 2 in common, 1 not in common") ... easier to work with variable scheme X1-X6 rather than names, data step seems like a lot easier way to make a simple data set ... data g; infile datalines dsd; input group :$1. x1-x6; datalines; 1,0,1,1,0,0,0 2,0,0,0,0,1,1 3,0,0,0,0,1,1 4,1,0,0,1,0,0 5,1,0,0,1,0,0 6,1,1,0,1,0,0 7,0,1,0,1,0,0 ; data gplus (keep=common nocomm group:); set g (rename=(group=group1)) nobs=howmany; array x(6); do j=_n_ + 1 to howmany; set g (rename=(x1-x6=y1-y6 group=group2)) point=j; array y(6); do k=1 to 6; common + (x(k)+y(k) eq 2); nocomm + (x(k)+y(k) eq 1); end; output; call missing(common,nocomm); end; run; output ... Obs group1 group2 common nocomm 1 1 2 0 4 2 1 3 0 4 3 1 4 0 4 4 1 5 0 4 5 1 6 1 3 6 1 7 1 2 7 2 3 2 0 8 2 4 0 4 9 2 5 0 4 10 2 6 0 5 11 2 7 0 4 12 3 4 0 4 13 3 5 0 4 14 3 6 0 5 15 3 7 0 4 16 4 5 2 0 17 4 6 2 1 18 4 7 1 2 19 5 6 2 1 20 5 7 1 2 21 6 7 2 1 (idea for second data step from Tom's recent posting for question on how to "Create Vector" in SAS Macro Facility, Data Step and SAS Language Elements ... thanks)
... View more