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 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

Register 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
  • 3820 views
  • 10 likes
  • 3 in conversation