It's even easier to get all combinations:
data all;
do x1=1 to 60;
do x2=x1+1 to 60;
do x3=x2+1 to 60;
do x4=x3+1 to 60;
do x5=x4+1 to 60;
do x6=x5+1 to 60;
output;
end;
end;
end;
end;
end;
end;
run; /* Log: NOTE: The data set WORK.ALL has 50063860 observations and 6 variables. */
You may add a random number and sort by it (see the earlier post), if you don't like the lexicographic order.
It's exactly the number of possible combinations of 6 out of 60 (binomial coefficient).
If you need all, you wouldn't create random combinations, but just all, systematically.
Just a mathematical side note: The probability that the NODUPKEY sort step will have to eliminate any duplicates is less than 1 in 10000 (at least in theory). So, the probability that the algorithm fails because of more than 40 duplicates must be minuscule.
That's the number of possibilities of a Raffle game.
No Reeza,
Thanks again guys, amazing answers.
Thanks
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.