Hi, If there are 66 items, we want to get 8 at a time. 66C6 = 5.7Billion+ combinations and look at the distribution from such event. Each Item will have a value Item 1 to 8 has value of 1; Item 9 to 16 has value of 2; Item 17 to 24 has value of 3; Item 25 to 32 has value of 4; Item 33 to 40 has value of 5; Item 41 to 48 has value of 6; Item 49 to 56 has value of 7; Item 57 to 64 has value of 8; Item 65 to 66 has value of 0.3; we want to get distribution on count how many Eights can be formed with the items + how many 0.3 was drawn -> Ecnt How many items not used to form eight -> Rcnt how many 0.3 was drawn -> Jcnt Examples are: 1 2 2 2 2 2 6 8 -> Ecnt: 3(three groups of eights formed), Rcnt 1 (one item not used), Jcnt:0 (no 0.3 ) 1 1 1 1 2 2 2 5 -> Ecnt: 1, Rcnt 4(although 5 2 1 can also form 8 and there will be 5 remainder we consider forming less Remainder as possible) .3 1 2 2 2 2 8 8-> Ecnt 4, Rcnt 1,Jcnt 1 in the end we want Enct Rcnt Jcnt Freq 1 0 0 1 1 1 0 ? 1 2 0 ? 1 3 0 ? 1 4 0 ? 1 5 0 ? 1 6 0 ? 1 7 0 ? 1 8 1 ? 2 0 0 ? 2 1 1 ? . . . . . . . . . . . . 8 0 0 . to generate this frequency i have the codes below, but it is too slow. can anyone help me improve this or any idea on another way we can do this? any help is appriciated. %macro Loop; /* suppress log generation 5.7Billion x Xlog lines will kill any EG and desktop*/ options nonotes nomlogic nomprint nosymbolgen nosource nosource2; proc sql; Drop table FINAL, FINALX, temp; quit; %put Start: %sysfunc(time(),timeampm.); /* create lexi comb 66C8 loop*/ %do i1=1 %to 59; %do i2=&i1+1 %to 60; %do i3=&i2+1 %to 61; %do i4=&i3+1 %to 62; %do i5=&i4+1 %to 63; %do i6=&i5+1 %to 64; %do i7=&i6+1 %to 65; %do i8=&i7+1 %to 66; data temp; /* initialize counters*/ Ecnt=0; Rcnt=0; Jcnt=0; Freq=1; /* Assign Value of cards*/ if 1<=&i1<=8 then i1=1; else if 9<=&i1<=16 then i1=2; else if 17<=&i1<=24 then i1=3; else if 25<=&i1<=32 then i1=4; else if 33<=&i1<=40 then i1=5; else if 41<=&i1<=48 then i1=6; else if 49<=&i1<=56 then i1=7; else if 57<=&i1<=64 then i1=8; else if 65<=&i1<=66 then i1=.3; if 1<=&i2<=8 then i2=1; else if 9<=&i2<=16 then i2=2; else if 17<=&i2<=24 then i2=3; else if 25<=&i2<=32 then i2=4; else if 33<=&i2<=40 then i2=5; else if 41<=&i2<=48 then i2=6; else if 49<=&i2<=56 then i2=7; else if 57<=&i2<=64 then i2=8; else if 65<=&i2<=66 then i2=.3; if 1<=&i3<=8 then i3=1; else if 9<=&i3<=16 then i3=2; else if 17<=&i3<=24 then i3=3; else if 25<=&i3<=32 then i3=4; else if 33<=&i3<=40 then i3=5; else if 41<=&i3<=48 then i3=6; else if 49<=&i3<=56 then i3=7; else if 57<=&i3<=64 then i3=8; else if 65<=&i3<=66 then i3=.3; if 1<=&i4<=8 then i4=1; else if 9<=&i4<=16 then i4=2; else if 17<=&i4<=24 then i4=3; else if 25<=&i4<=32 then i4=4; else if 33<=&i4<=40 then i4=5; else if 41<=&i4<=48 then i4=6; else if 49<=&i4<=56 then i4=7; else if 57<=&i4<=64 then i4=8; else if 65<=&i4<=66 then i4=.3; if 1<=&i5<=8 then i5=1; else if 9<=&i5<=16 then i5=2; else if 17<=&i5<=24 then i5=3; else if 25<=&i5<=32 then i5=4; else if 33<=&i5<=40 then i5=5; else if 41<=&i5<=48 then i5=6; else if 49<=&i5<=56 then i5=7; else if 57<=&i5<=64 then i5=8; else if 65<=&i5<=66 then i5=.3; if 1<=&i6<=8 then i6=1; else if 9<=&i6<=16 then i6=2; else if 17<=&i6<=24 then i6=3; else if 25<=&i6<=32 then i6=4; else if 33<=&i6<=40 then i6=5; else if 41<=&i6<=48 then i6=6; else if 49<=&i6<=56 then i6=7; else if 57<=&i6<=64 then i6=8; else if 65<=&i6<=66 then i6=.3; if 1<=&i7<=8 then i7=1; else if 9<=&i7<=16 then i7=2; else if 17<=&i7<=24 then i7=3; else if 25<=&i7<=32 then i7=4; else if 33<=&i7<=40 then i7=5; else if 41<=&i7<=48 then i7=6; else if 49<=&i7<=56 then i7=7; else if 57<=&i7<=64 then i7=8; else if 65<=&i7<=66 then i7=.3; if 1<=&i8<=8 then i8=1; else if 9<=&i8<=16 then i8=2; else if 17<=&i8<=24 then i8=3; else if 25<=&i8<=32 then i8=4; else if 33<=&i8<=40 then i8=5; else if 41<=&i8<=48 then i8=6; else if 49<=&i8<=56 then i8=7; else if 57<=&i8<=64 then i8=8; else if 65<=&i8<=66 then i8=.3; /* Check group of eights use most cards as possible C8 to C1*/ /* if combination sum is 8 then add to Ecnt counter and replace value as 0*/ /*C8*/ if i1+i2+i3+i4+i5+i6+i7+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; /*C7*/ if i2+i3+i4+i5+i6+i7+i8=8 then do; i2=0; i3=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i3+i4+i5+i6+i7+i8=8 then do; i1=0; i3=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i4+i5+i6+i7+i8=8 then do; i1=0; i2=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i5+i6+i7+i8=8 then do; i1=0; i2=0; i3=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i6+i7+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i5+i7+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i5+i6+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i5+i6+i7=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; /*C6*/ if i3+i4+i5+i6+i7+i8=8 then do; i3=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2+i4+i5+i6+i7+i8=8 then do; i2=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2+i3+i5+i6+i7+i8=8 then do; i2=0; i3=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2+i3+i4+i6+i7+i8=8 then do; i2=0; i3=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2+i3+i4+i5+i7+i8=8 then do; i2=0; i3=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i2+i3+i4+i5+i6+i8=8 then do; i2=0; i3=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i2+i3+i4+i5+i6+i7=8 then do; i2=0; i3=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1+i4+i5+i6+i7+i8=8 then do; i1=0; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i3+i5+i6+i7+i8=8 then do; i1=0; i3=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i3+i4+i6+i7+i8=8 then do; i1=0; i3=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i3+i4+i5+i7+i8=8 then do; i1=0; i3=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1+i3+i4+i5+i6+i8=8 then do; i1=0; i3=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1+i3+i4+i5+i6+i7=8 then do; i1=0; i3=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1+i2+i5+i6+i7+i8=8 then do; i1=0; i2=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i4+i6+i7+i8=8 then do; i1=0; i2=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i4+i5+i7+i8=8 then do; i1=0; i2=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i4+i5+i6+i8=8 then do; i1=0; i2=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1+i2+i4+i5+i6+i7=8 then do; i1=0; i2=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1+i2+i3+i6+i7+i8=8 then do; i1=0; i2=0; i3=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i5+i7+i8=8 then do; i1=0; i2=0; i3=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i5+i6+i8=8 then do; i1=0; i2=0; i3=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1+i2+i3+i5+i6+i7=8 then do; i1=0; i2=0; i3=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1+i2+i3+i4+i7+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i7=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i6+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i6=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i6+i7=8 then do; i1=0; i2=0; i3=0; i4=0; i6=0; i7=0; ecnt+1; end; if i1+i2+i3+i4+i5+i8=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i8=0; ecnt+1; end; if i1+i2+i3+i4+i5+i7=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i7=0; ecnt+1; end; if i1+i2+i3+i4+i5+i6=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; i6=0; ecnt+1; end; /*C5*/ if i1 + i2 + i3 + i4 + i5=8 then do; i1=0; i2=0; i3=0; i4=0; i5=0; ecnt+1; end; if i1 + i2 + i3 + i4 + i6=8 then do; i1=0; i2=0; i3=0; i4=0; i6=0; ecnt+1; end; if i1 + i2 + i3 + i4 + i7=8 then do; i1=0; i2=0; i3=0; i4=0; i7=0; ecnt+1; end; if i1 + i2 + i3 + i4 + i8=8 then do; i1=0; i2=0; i3=0; i4=0; i8=0; ecnt+1; end; if i1 + i2 + i3 + i5 + i6=8 then do; i1=0; i2=0; i3=0; i5=0; i6=0; ecnt+1; end; if i1 + i2 + i3 + i5 + i7=8 then do; i1=0; i2=0; i3=0; i5=0; i7=0; ecnt+1; end; if i1 + i2 + i3 + i5 + i8=8 then do; i1=0; i2=0; i3=0; i5=0; i8=0; ecnt+1; end; if i1 + i2 + i3 + i6 + i7=8 then do; i1=0; i2=0; i3=0; i6=0; i7=0; ecnt+1; end; if i1 + i2 + i3 + i6 + i8=8 then do; i1=0; i2=0; i3=0; i6=0; i8=0; ecnt+1; end; if i1 + i2 + i3 + i7 + i8=8 then do; i1=0; i2=0; i3=0; i7=0; i8=0; ecnt+1; end; if i1 + i2 + i4 + i5 + i6=8 then do; i1=0; i2=0; i4=0; i5=0; i6=0; ecnt+1; end; if i1 + i2 + i4 + i5 + i7=8 then do; i1=0; i2=0; i4=0; i5=0; i7=0; ecnt+1; end; if i1 + i2 + i4 + i5 + i8=8 then do; i1=0; i2=0; i4=0; i5=0; i8=0; ecnt+1; end; if i1 + i2 + i4 + i6 + i7=8 then do; i1=0; i2=0; i4=0; i6=0; i7=0; ecnt+1; end; if i1 + i2 + i4 + i6 + i8=8 then do; i1=0; i2=0; i4=0; i6=0; i8=0; ecnt+1; end; if i1 + i2 + i4 + i7 + i8=8 then do; i1=0; i2=0; i4=0; i7=0; i8=0; ecnt+1; end; if i1 + i2 + i5 + i6 + i7=8 then do; i1=0; i2=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1 + i2 + i5 + i6 + i8=8 then do; i1=0; i2=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1 + i2 + i5 + i7 + i8=8 then do; i1=0; i2=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1 + i2 + i6 + i7 + i8=8 then do; i1=0; i2=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1 + i3 + i4 + i5 + i6=8 then do; i1=0; i3=0; i4=0; i5=0; i6=0; ecnt+1; end; if i1 + i3 + i4 + i5 + i7=8 then do; i1=0; i3=0; i4=0; i5=0; i7=0; ecnt+1; end; if i1 + i3 + i4 + i5 + i8=8 then do; i1=0; i3=0; i4=0; i5=0; i8=0; ecnt+1; end; if i1 + i3 + i4 + i6 + i7=8 then do; i1=0; i3=0; i4=0; i6=0; i7=0; ecnt+1; end; if i1 + i3 + i4 + i6 + i8=8 then do; i1=0; i3=0; i4=0; i6=0; i8=0; ecnt+1; end; if i1 + i3 + i4 + i7 + i8=8 then do; i1=0; i3=0; i4=0; i7=0; i8=0; ecnt+1; end; if i1 + i3 + i5 + i6 + i7=8 then do; i1=0; i3=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1 + i3 + i5 + i6 + i8=8 then do; i1=0; i3=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1 + i3 + i5 + i7 + i8=8 then do; i1=0; i3=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1 + i3 + i6 + i7 + i8=8 then do; i1=0; i3=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1 + i4 + i5 + i6 + i7=8 then do; i1=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1 + i4 + i5 + i6 + i8=8 then do; i1=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1 + i4 + i5 + i7 + i8=8 then do; i1=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1 + i4 + i6 + i7 + i8=8 then do; i1=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i1 + i5 + i6 + i7 + i8=8 then do; i1=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2 + i3 + i4 + i5 + i6=8 then do; i2=0; i3=0; i4=0; i5=0; i6=0; ecnt+1; end; if i2 + i3 + i4 + i5 + i7=8 then do; i2=0; i3=0; i4=0; i5=0; i7=0; ecnt+1; end; if i2 + i3 + i4 + i5 + i8=8 then do; i2=0; i3=0; i4=0; i5=0; i8=0; ecnt+1; end; if i2 + i3 + i4 + i6 + i7=8 then do; i2=0; i3=0; i4=0; i6=0; i7=0; ecnt+1; end; if i2 + i3 + i4 + i6 + i8=8 then do; i2=0; i3=0; i4=0; i6=0; i8=0; ecnt+1; end; if i2 + i3 + i4 + i7 + i8=8 then do; i2=0; i3=0; i4=0; i7=0; i8=0; ecnt+1; end; if i2 + i3 + i5 + i6 + i7=8 then do; i2=0; i3=0; i5=0; i6=0; i7=0; ecnt+1; end; if i2 + i3 + i5 + i6 + i8=8 then do; i2=0; i3=0; i5=0; i6=0; i8=0; ecnt+1; end; if i2 + i3 + i5 + i7 + i8=8 then do; i2=0; i3=0; i5=0; i7=0; i8=0; ecnt+1; end; if i2 + i3 + i6 + i7 + i8=8 then do; i2=0; i3=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2 + i4 + i5 + i6 + i7=8 then do; i2=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i2 + i4 + i5 + i6 + i8=8 then do; i2=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i2 + i4 + i5 + i7 + i8=8 then do; i2=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i2 + i4 + i6 + i7 + i8=8 then do; i2=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2 + i5 + i6 + i7 + i8=8 then do; i2=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i3 + i4 + i5 + i6 + i7=8 then do; i3=0; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i3 + i4 + i5 + i6 + i8=8 then do; i3=0; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i3 + i4 + i5 + i7 + i8=8 then do; i3=0; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i3 + i4 + i6 + i7 + i8=8 then do; i3=0; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i3 + i5 + i6 + i7 + i8=8 then do; i3=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; if i4 + i5 + i6 + i7 + i8=8 then do; i4=0; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; /*C4*/ if i1+ i2+ i3+ i4=8 then do; i1=0; i2=0; i3=0; i4=0; ecnt+1; end; if i1+ i2+ i3+ i5=8 then do; i1=0; i2=0; i3=0; i5=0; ecnt+1; end; if i1+ i2+ i3+ i6=8 then do; i1=0; i2=0; i3=0; i6=0; ecnt+1; end; if i1+ i2+ i3+ i7=8 then do; i1=0; i2=0; i3=0; i7=0; ecnt+1; end; if i1+ i2+ i3+ i8=8 then do; i1=0; i2=0; i3=0; i8=0; ecnt+1; end; if i1+ i2+ i4+ i5=8 then do; i1=0; i2=0; i4=0; i5=0; ecnt+1; end; if i1+ i2+ i4+ i6=8 then do; i1=0; i2=0; i4=0; i6=0; ecnt+1; end; if i1+ i2+ i4+ i7=8 then do; i1=0; i2=0; i4=0; i7=0; ecnt+1; end; if i1+ i2+ i4+ i8=8 then do; i1=0; i2=0; i4=0; i8=0; ecnt+1; end; if i1+ i2+ i5+ i6=8 then do; i1=0; i2=0; i5=0; i6=0; ecnt+1; end; if i1+ i2+ i5+ i7=8 then do; i1=0; i2=0; i5=0; i7=0; ecnt+1; end; if i1+ i2+ i5+ i8=8 then do; i1=0; i2=0; i5=0; i8=0; ecnt+1; end; if i1+ i2+ i6+ i7=8 then do; i1=0; i2=0; i6=0; i7=0; ecnt+1; end; if i1+ i2+ i6+ i8=8 then do; i1=0; i2=0; i6=0; i8=0; ecnt+1; end; if i1+ i2+ i7+ i8=8 then do; i1=0; i2=0; i7=0; i8=0; ecnt+1; end; if i1+ i3+ i4+ i5=8 then do; i1=0; i3=0; i4=0; i5=0; ecnt+1; end; if i1+ i3+ i4+ i6=8 then do; i1=0; i3=0; i4=0; i6=0; ecnt+1; end; if i1+ i3+ i4+ i7=8 then do; i1=0; i3=0; i4=0; i7=0; ecnt+1; end; if i1+ i3+ i4+ i8=8 then do; i1=0; i3=0; i4=0; i8=0; ecnt+1; end; if i1+ i3+ i5+ i6=8 then do; i1=0; i3=0; i5=0; i6=0; ecnt+1; end; if i1+ i3+ i5+ i7=8 then do; i1=0; i3=0; i5=0; i7=0; ecnt+1; end; if i1+ i3+ i5+ i8=8 then do; i1=0; i3=0; i5=0; i8=0; ecnt+1; end; if i1+ i3+ i6+ i7=8 then do; i1=0; i3=0; i6=0; i7=0; ecnt+1; end; if i1+ i3+ i6+ i8=8 then do; i1=0; i3=0; i6=0; i8=0; ecnt+1; end; if i1+ i3+ i7+ i8=8 then do; i1=0; i3=0; i7=0; i8=0; ecnt+1; end; if i1+ i4+ i5+ i6=8 then do; i1=0; i4=0; i5=0; i6=0; ecnt+1; end; if i1+ i4+ i5+ i7=8 then do; i1=0; i4=0; i5=0; i7=0; ecnt+1; end; if i1+ i4+ i5+ i8=8 then do; i1=0; i4=0; i5=0; i8=0; ecnt+1; end; if i1+ i4+ i6+ i7=8 then do; i1=0; i4=0; i6=0; i7=0; ecnt+1; end; if i1+ i4+ i6+ i8=8 then do; i1=0; i4=0; i6=0; i8=0; ecnt+1; end; if i1+ i4+ i7+ i8=8 then do; i1=0; i4=0; i7=0; i8=0; ecnt+1; end; if i1+ i5+ i6+ i7=8 then do; i1=0; i5=0; i6=0; i7=0; ecnt+1; end; if i1+ i5+ i6+ i8=8 then do; i1=0; i5=0; i6=0; i8=0; ecnt+1; end; if i1+ i5+ i7+ i8=8 then do; i1=0; i5=0; i7=0; i8=0; ecnt+1; end; if i1+ i6+ i7+ i8=8 then do; i1=0; i6=0; i7=0; i8=0; ecnt+1; end; if i2+ i3+ i4+ i5=8 then do; i2=0; i3=0; i4=0; i5=0; ecnt+1; end; if i2+ i3+ i4+ i6=8 then do; i2=0; i3=0; i4=0; i6=0; ecnt+1; end; if i2+ i3+ i4+ i7=8 then do; i2=0; i3=0; i4=0; i7=0; ecnt+1; end; if i2+ i3+ i4+ i8=8 then do; i2=0; i3=0; i4=0; i8=0; ecnt+1; end; if i2+ i3+ i5+ i6=8 then do; i2=0; i3=0; i5=0; i6=0; ecnt+1; end; if i2+ i3+ i5+ i7=8 then do; i2=0; i3=0; i5=0; i7=0; ecnt+1; end; if i2+ i3+ i5+ i8=8 then do; i2=0; i3=0; i5=0; i8=0; ecnt+1; end; if i2+ i3+ i6+ i7=8 then do; i2=0; i3=0; i6=0; i7=0; ecnt+1; end; if i2+ i3+ i6+ i8=8 then do; i2=0; i3=0; i6=0; i8=0; ecnt+1; end; if i2+ i3+ i7+ i8=8 then do; i2=0; i3=0; i7=0; i8=0; ecnt+1; end; if i2+ i4+ i5+ i6=8 then do; i2=0; i4=0; i5=0; i6=0; ecnt+1; end; if i2+ i4+ i5+ i7=8 then do; i2=0; i4=0; i5=0; i7=0; ecnt+1; end; if i2+ i4+ i5+ i8=8 then do; i2=0; i4=0; i5=0; i8=0; ecnt+1; end; if i2+ i4+ i6+ i7=8 then do; i2=0; i4=0; i6=0; i7=0; ecnt+1; end; if i2+ i4+ i6+ i8=8 then do; i2=0; i4=0; i6=0; i8=0; ecnt+1; end; if i2+ i4+ i7+ i8=8 then do; i2=0; i4=0; i7=0; i8=0; ecnt+1; end; if i2+ i5+ i6+ i7=8 then do; i2=0; i5=0; i6=0; i7=0; ecnt+1; end; if i2+ i5+ i6+ i8=8 then do; i2=0; i5=0; i6=0; i8=0; ecnt+1; end; if i2+ i5+ i7+ i8=8 then do; i2=0; i5=0; i7=0; i8=0; ecnt+1; end; if i2+ i6+ i7+ i8=8 then do; i2=0; i6=0; i7=0; i8=0; ecnt+1; end; if i3+ i4+ i5+ i6=8 then do; i3=0; i4=0; i5=0; i6=0; ecnt+1; end; if i3+ i4+ i5+ i7=8 then do; i3=0; i4=0; i5=0; i7=0; ecnt+1; end; if i3+ i4+ i5+ i8=8 then do; i3=0; i4=0; i5=0; i8=0; ecnt+1; end; if i3+ i4+ i6+ i7=8 then do; i3=0; i4=0; i6=0; i7=0; ecnt+1; end; if i3+ i4+ i6+ i8=8 then do; i3=0; i4=0; i6=0; i8=0; ecnt+1; end; if i3+ i4+ i7+ i8=8 then do; i3=0; i4=0; i7=0; i8=0; ecnt+1; end; if i3+ i5+ i6+ i7=8 then do; i3=0; i5=0; i6=0; i7=0; ecnt+1; end; if i3+ i5+ i6+ i8=8 then do; i3=0; i5=0; i6=0; i8=0; ecnt+1; end; if i3+ i5+ i7+ i8=8 then do; i3=0; i5=0; i7=0; i8=0; ecnt+1; end; if i3+ i6+ i7+ i8=8 then do; i3=0; i6=0; i7=0; i8=0; ecnt+1; end; if i4+ i5+ i6+ i7=8 then do; i4=0; i5=0; i6=0; i7=0; ecnt+1; end; if i4+ i5+ i6+ i8=8 then do; i4=0; i5=0; i6=0; i8=0; ecnt+1; end; if i4+ i5+ i7+ i8=8 then do; i4=0; i5=0; i7=0; i8=0; ecnt+1; end; if i4+ i6+ i7+ i8=8 then do; i4=0; i6=0; i7=0; i8=0; ecnt+1; end; if i5+ i6+ i7+ i8=8 then do; i5=0; i6=0; i7=0; i8=0; ecnt+1; end; /*C3*/ if i1+ i2+ i3=8 then do; i1=0; i2=0; i3=0; ecnt+1; end; if i1+ i2+ i4=8 then do; i1=0; i2=0; i4=0; ecnt+1; end; if i1+ i2+ i5=8 then do; i1=0; i2=0; i5=0; ecnt+1; end; if i1+ i2+ i6=8 then do; i1=0; i2=0; i6=0; ecnt+1; end; if i1+ i2+ i7=8 then do; i1=0; i2=0; i7=0; ecnt+1; end; if i1+ i2+ i8=8 then do; i1=0; i2=0; i8=0; ecnt+1; end; if i1+ i3+ i4=8 then do; i1=0; i3=0; i4=0; ecnt+1; end; if i1+ i3+ i5=8 then do; i1=0; i3=0; i5=0; ecnt+1; end; if i1+ i3+ i6=8 then do; i1=0; i3=0; i6=0; ecnt+1; end; if i1+ i3+ i7=8 then do; i1=0; i3=0; i7=0; ecnt+1; end; if i1+ i3+ i8=8 then do; i1=0; i3=0; i8=0; ecnt+1; end; if i1+ i4+ i5=8 then do; i1=0; i4=0; i5=0; ecnt+1; end; if i1+ i4+ i6=8 then do; i1=0; i4=0; i6=0; ecnt+1; end; if i1+ i4+ i7=8 then do; i1=0; i4=0; i7=0; ecnt+1; end; if i1+ i4+ i8=8 then do; i1=0; i4=0; i8=0; ecnt+1; end; if i1+ i5+ i6=8 then do; i1=0; i5=0; i6=0; ecnt+1; end; if i1+ i5+ i7=8 then do; i1=0; i5=0; i7=0; ecnt+1; end; if i1+ i5+ i8=8 then do; i1=0; i5=0; i8=0; ecnt+1; end; if i1+ i6+ i7=8 then do; i1=0; i6=0; i7=0; ecnt+1; end; if i1+ i6+ i8=8 then do; i1=0; i6=0; i8=0; ecnt+1; end; if i1+ i7+ i8=8 then do; i1=0; i7=0; i8=0; ecnt+1; end; if i2+ i3+ i4=8 then do; i2=0; i3=0; i4=0; ecnt+1; end; if i2+ i3+ i5=8 then do; i2=0; i3=0; i5=0; ecnt+1; end; if i2+ i3+ i6=8 then do; i2=0; i3=0; i6=0; ecnt+1; end; if i2+ i3+ i7=8 then do; i2=0; i3=0; i7=0; ecnt+1; end; if i2+ i3+ i8=8 then do; i2=0; i3=0; i8=0; ecnt+1; end; if i2+ i4+ i5=8 then do; i2=0; i4=0; i5=0; ecnt+1; end; if i2+ i4+ i6=8 then do; i2=0; i4=0; i6=0; ecnt+1; end; if i2+ i4+ i7=8 then do; i2=0; i4=0; i7=0; ecnt+1; end; if i2+ i4+ i8=8 then do; i2=0; i4=0; i8=0; ecnt+1; end; if i2+ i5+ i6=8 then do; i2=0; i5=0; i6=0; ecnt+1; end; if i2+ i5+ i7=8 then do; i2=0; i5=0; i7=0; ecnt+1; end; if i2+ i5+ i8=8 then do; i2=0; i5=0; i8=0; ecnt+1; end; if i2+ i6+ i7=8 then do; i2=0; i6=0; i7=0; ecnt+1; end; if i2+ i6+ i8=8 then do; i2=0; i6=0; i8=0; ecnt+1; end; if i2+ i7+ i8=8 then do; i2=0; i7=0; i8=0; ecnt+1; end; if i3+ i4+ i5=8 then do; i3=0; i4=0; i5=0; ecnt+1; end; if i3+ i4+ i6=8 then do; i3=0; i4=0; i6=0; ecnt+1; end; if i3+ i4+ i7=8 then do; i3=0; i4=0; i7=0; ecnt+1; end; if i3+ i4+ i8=8 then do; i3=0; i4=0; i8=0; ecnt+1; end; if i3+ i5+ i6=8 then do; i3=0; i5=0; i6=0; ecnt+1; end; if i3+ i5+ i7=8 then do; i3=0; i5=0; i7=0; ecnt+1; end; if i3+ i5+ i8=8 then do; i3=0; i5=0; i8=0; ecnt+1; end; if i3+ i6+ i7=8 then do; i3=0; i6=0; i7=0; ecnt+1; end; if i3+ i6+ i8=8 then do; i3=0; i6=0; i8=0; ecnt+1; end; if i3+ i7+ i8=8 then do; i3=0; i7=0; i8=0; ecnt+1; end; if i4+ i5+ i6=8 then do; i4=0; i5=0; i6=0; ecnt+1; end; if i4+ i5+ i7=8 then do; i4=0; i5=0; i7=0; ecnt+1; end; if i4+ i5+ i8=8 then do; i4=0; i5=0; i8=0; ecnt+1; end; if i4+ i6+ i7=8 then do; i4=0; i6=0; i7=0; ecnt+1; end; if i4+ i6+ i8=8 then do; i4=0; i6=0; i8=0; ecnt+1; end; if i4+ i7+ i8=8 then do; i4=0; i7=0; i8=0; ecnt+1; end; if i5+ i6+ i7=8 then do; i5=0; i6=0; i7=0; ecnt+1; end; if i5+ i6+ i8=8 then do; i5=0; i6=0; i8=0; ecnt+1; end; if i5+ i7+ i8=8 then do; i5=0; i7=0; i8=0; ecnt+1; end; if i6+ i7+ i8=8 then do; i6=0; i7=0; i8=0; ecnt+1; end; /*C2*/ if i1+ i2=8 then do; i1=0; i2=0; ecnt+1; end; if i1+ i3=8 then do; i1=0; i3=0; ecnt+1; end; if i1+ i4=8 then do; i1=0; i4=0; ecnt+1; end; if i1+ i5=8 then do; i1=0; i5=0; ecnt+1; end; if i1+ i6=8 then do; i1=0; i6=0; ecnt+1; end; if i1+ i7=8 then do; i1=0; i7=0; ecnt+1; end; if i1+ i8=8 then do; i1=0; i8=0; ecnt+1; end; if i2+ i3=8 then do; i2=0; i3=0; ecnt+1; end; if i2+ i4=8 then do; i2=0; i4=0; ecnt+1; end; if i2+ i5=8 then do; i2=0; i5=0; ecnt+1; end; if i2+ i6=8 then do; i2=0; i6=0; ecnt+1; end; if i2+ i7=8 then do; i2=0; i7=0; ecnt+1; end; if i2+ i8=8 then do; i2=0; i8=0; ecnt+1; end; if i3+ i4=8 then do; i3=0; i4=0; ecnt+1; end; if i3+ i5=8 then do; i3=0; i5=0; ecnt+1; end; if i3+ i6=8 then do; i3=0; i6=0; ecnt+1; end; if i3+ i7=8 then do; i3=0; i7=0; ecnt+1; end; if i3+ i8=8 then do; i3=0; i8=0; ecnt+1; end; if i4+ i5=8 then do; i4=0; i5=0; ecnt+1; end; if i4+ i6=8 then do; i4=0; i6=0; ecnt+1; end; if i4+ i7=8 then do; i4=0; i7=0; ecnt+1; end; if i4+ i8=8 then do; i4=0; i8=0; ecnt+1; end; if i5+ i6=8 then do; i5=0; i6=0; ecnt+1; end; if i5+ i7=8 then do; i5=0; i7=0; ecnt+1; end; if i5+ i8=8 then do; i5=0; i8=0; ecnt+1; end; if i6+ i7=8 then do; i6=0; i7=0; ecnt+1; end; if i6+ i8=8 then do; i6=0; i8=0; ecnt+1; end; if i7+ i8=8 then do; i7=0; i8=0; ecnt+1; end; /*C1*/ if i8=8 then do; i8=0; ecnt+1; end; if i7=8 then do; i7=0; ecnt+1; end; if i6=8 then do; i6=0; ecnt+1; end; if i5=8 then do; i5=0; ecnt+1; end; if i4=8 then do; i4=0; ecnt+1; end; if i3=8 then do; i3=0; ecnt+1; end; if i2=8 then do; i2=0; ecnt+1; end; if i1=8 then do; i1=0; ecnt+1; end; /*cards not used*/ if i1>0 then Rcnt+1; if i2>0 then Rcnt+1; if i3>0 then Rcnt+1; if i4>0 then Rcnt+1; if i5>0 then Rcnt+1; if i6>0 then Rcnt+1; if i7>0 then Rcnt+1; if i8>0 then Rcnt+1; /*Joker*/ if i1=.3 then do; Jcnt+1; ecnt+1; end; if i2=.3 then do; Jcnt+1; ecnt+1; end; if i3=.3 then do; Jcnt+1; ecnt+1; end; if i4=.3 then do; Jcnt+1; ecnt+1; end; if i5=.3 then do; Jcnt+1; ecnt+1; end; if i6=.3 then do; Jcnt+1; ecnt+1; end; if i7=.3 then do; Jcnt+1; ecnt+1; end; if i8=.3 then do; Jcnt+1; ecnt+1; end; keep Ecnt Rcnt Jcnt Freq; run; /* append result to Freq table*/ proc append base=FINAL data=temp force; quit; /* summarize freq table w/o recurrsive warning*/ proc sql; create table FINALx as select Ecnt , Rcnt , Jcnt , sum(Freq) as Freq from FINAL group by Ecnt , Rcnt , Jcnt; create table FINAL as select * from FINALX; Drop table FINALX, temp; quit; /* repeat*/ %end; %end; %end; %end; %end; %end; %end; %end; %put END: %sysfunc(time(),timeampm.); %mend loop; %loop;
... View more