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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.