hi ... here's one idea using PROC SUMMARY, the test data has 100 people and 10 binary variables (but I agree with Doc ... it's a MUCH LARGER problem with many more variables) it answers "3 at a time" and you can modify for 4 and/or 5 * test data; data x; array x(10); do id = 1 to 100; do _n_ = 1 to 10; x(_n_) = (ranuni(999) gt .5); end; output; end; run; * use summary with no var statement; proc summary data=x ; class x1-x10; output out=counts; run; * look for observations with only 3 occurrences of 1; data group3 (keep=v: _freq_); array x(10); array v(3) $32; set counts; if n(of x1-x10) eq 3 and sum(of x1-x10,0) eq 3; loc = find(catt(of x1-x10),'1'); v1 = vname(x(loc)); loc = find(catt(of x1-x10),'1',loc+1); v2 = vname(x(loc)); loc = find(catt(of x1-x10),'1',loc+1); v3 = vname(x(loc)); run; * change the order of the data set (x1 x2 x3 1st, x1 x2 x4 2nd, etc. ); proc sort data=group3 sortseq=linguistic(numeric_collation=on); by v1 v2 v3; run; a portion of the output ... v1 v2 v3 _FREQ_ x1 x2 x3 9 x1 x2 x4 10 x1 x2 x5 15 x1 x2 x6 15 x1 x2 x7 9 x1 x2 x8 8 x1 x2 x9 12 x1 x2 x10 13 x1 x3 x4 12 x1 x3 x5 18 x1 x3 x6 15 x1 x3 x7 14 x1 x3 x8 10 x1 x3 x9 11 x1 x3 x10 19 x1 x4 x5 16 x1 x4 x6 12 x1 x4 x7 14 x1 x4 x8 9 x1 x4 x9 12 x1 x4 x10 13
... View more