BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FreelanceReinh
Jade | Level 19

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.

FreelanceReinh
Jade | Level 19

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.

FreelanceReinh
Jade | Level 19

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.

DartRodrigo
Lapis Lazuli | Level 10

That's the number of possibilities of a Raffle game. 

Smiley Happy

Reeza
Super User
Ok....so do you have a question?
DartRodrigo
Lapis Lazuli | Level 10

No Reeza,

Thanks again guys, amazing answers.

 

Thanks 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 20 replies
  • 6911 views
  • 10 likes
  • 3 in conversation