10-30-2014 03:56 AM
Hi, I hope someone can help me.
I need to enumerate all combinations of 36 from 42 in SAS IML. I have the loops as such:
do i = 1 to ns-1;
do j = i+1 to ns;
do m = j+1 to ns;
do n = m+1 to ns;
Options[k,1] = i;
Options[k,2] = j;
Options[k,3] = m;
Options[k,4] = n;
Options[k,5] = o;
Which gives all combinations of 4 from the 42. Is there an easier way for SAS to do this for me rather than adding in so many do loops?
I need this for an allocation problem in which I am looking for the optimal assignment of swimmers to relay teams.
10-30-2014 06:34 AM
Use the ALLCOMB function:
n=comb(42,36); /* how many rows will you get? */
v = allcomb(42,36); /* create n x 36 matrix */
print (v[1:5,]); /* print first 5 rows */
For details and other examples in IML, see
For DATA step, see