Here are two pieces for looking at a reduced problem similar to the lottery.
/* here is a quick way to simulate the possible universe considering
order using balls with 1 to 6*/
data allposs;
do ball1= 1 to 6;
do ball2 = 1 to 6;
if ball1 ne ball2 then output;
end;
end;
run;
/* for your other summary data exercise would be change these
results to the ordered sequence */
/* you will note immediately that this is 2 6-sided dice with
the doubles removed
*/
/* simulating outcomes from above with a lottery*/
data sim;
p1= 1/6; /*probability of each number theoretically is 1/6 if fair for first ball draw*/
array p2 {6} ; /* to hold probabilities for the second draw. Arrays are a short cut way
of referencing many values using and indexing value to tell which
one if interest at the time. This statement creates variable
p21 p22 p23 p24 p25 p26
*/
/* the 5 below says to conduct 5 trials, increase as interested*/
do trial=1 to 5;
/* select first draw*/
ball1 = rand('TABLE',p1,p1,p1,p1,p1,p1);
/* set the probability of drawing any ball except
that already picked, since we know only one ball is picked
we know the prob. Could exend to 1/(n - number of balls already selected
*/
do i= 1 to dim(p2);
if i ne ball1 then p2[i]=1/5;
else p2[i]=0;
end;
/* select the second ball*/
ball2 = rand('TABLE',of p2(*));
output;
end;
/* remove the unwanted counter and the probability values*/
drop i p:;
run;
That second data step could be extended with a bit more loop nesting and holding which ball to select in an array. The probability array, to use this way, would need to have one position for each possible ball so the array p2 {6} would change to {69} for current powerball.