# SAS University Edition shows why the house usually wins in Las Vegas

by on ‎04-15-2016 08:37 AM - edited on ‎04-15-2016 12:59 PM by (618 Views)

• ,

• ,
• ### Tips and Tricks

I'm heading to Las Vegas on Monday with about 5,000 of my fellow SAS users for the annual SAS Global Forum. I’m really excited – I’ve not been to Global Forum since 2012, and I am really excited to see my friends again. So I decided to do something Vegas-related and use the two tasks in SAS University Edition that are directly related. Both are under the Combinatorics and Probability group.

The two (well, technically three) tasks we’re looking at are the Combinations / Poker Hand Probability and the Dice Roll Simulation tasks. These tasks do not use external data because they create their own data. So let’s get started with setting up the tasks, and see what we can find!

First, we’ll take a look at the Poker Hand Probability task. The first step, as indicated by the notes in the task, are to run the Combinations task first.

You can modify the number of objects (which defaults to 52, with 5 objects in a set). The task outputs data to the Combo dataset. After the task is run, the Poker Hand task can be opened.

Nothing really to do here – all you need to do is run the task.

So based on a standard 52-card deck, with 5 cards dealt to me, I have just over a 50% chance of getting nothing; one pair is 42%, and from there the percentages rapidly slide down to the practically impossible.

The next task is the Dice Roll Simulation task; all you need to do is specify the number of dice (2 is the default) and the number of rolls (100,000,000 is also the default).

Looking at the output, all I have to say is yikes!

You have a less than 3% chance of rolling a 2 or a 12; your best bets are a 4 or a 10, which each having 8% of coming up.

Now it’s your turn!

Did you find something else interesting in this data? Share in the comments. I’m glad to answer any questions.

Need data for learning?

The SAS Communities Library has a growing supply of free data sources that you can use in your training to become a data scientist. The easiest way to find articles about data sources is to type "Data for learning" in the communities site search field like so:

We publish all articles about free data sources under the Analytics U label in the SAS Communities Library. Want email notifications when we add new content? Subscribe to the Analytics U label by clicking "Find A Community" in the right nav and selecting SAS Communities Library at the bottom of the list. In the Labels box in the right nav, click Analytics U:

Click Analytics U, then select "Subscribe" from the Options menu.

Happy Learning!

by
on ‎04-15-2016 11:17 AM

Wondering what criteria were used to base this statement "your best bets are a 4 or a 10, which each having 8% of coming up." as that is not at all obvious from a simple probability standpoint. So assuming you are discussing Craps, the conclusion should be based on rules of the game, probably as played in casinos which may vary from street games.

by
on ‎04-15-2016 12:48 PM

Hi @ballardw - thanks for the comments!  I must admit, I'm not that well versed in the rules of gambling, and was looking at the straight Probabilities generated by the SAS University task.  Having said that, I think my logic was flawed when I was writing the article last night; my thought was that you have more of a chance of hitting a 4 or a 10 combined versus the other values, but I see now that's not true.  You're more likely to get a 7 (obviously at 16.6%).

thanks for reading; will i get to meet you at SGF next week?

Have a great weekend

Chris

by
on ‎04-15-2016 03:47 PM

Work won't pay for SGF and I don't have a budget or vacation for such.

The SAS/AF package used to have a demonstration program that had video poker, Black Jack (21) and Slot machines. I don't remember if there was a Craps game though there may have been.

Very simply Craps is an exercise in dependent probabilities: First roll if you get 7 or 11 you win, 1 and 12 lose . Any other number is the Point. You then roll repeatedly until you get your point (win) or roll 7 or 11 (lose).

In Casinos you usually get to make additional bets after the point is set, and other players get to bet as well.

And the simulation is just a tad off from the mathematical probability. A small number of dice of known size and you can create all the permutations very simply:

``````data sim;
do d1=1 to 6;
do d2 = 1 to 6;
sum = d1+d2;
output;
end;
end;
run;

proc freq data=sim noprint;
tables sum/out=temp;
run;

proc print data=temp noobs label;
var sum percent;
format percent f11.8;
label
sum="Value Rolled"
Percent="Probability"
;
run;``````

Result:

``` Value
Rolled    Probability

2       2.77777778
3       5.55555556
4       8.33333333
5      11.11111111
6      13.88888889
7      16.66666667
8      13.88888889
9      11.11111111
10       8.33333333
11       5.55555556
12       2.77777778

```
by
on ‎04-15-2016 04:04 PM

thank you so much for the clarification; here I was thinking this was a "fun" piece and I've still walked away learning something!

Bummer i won't get to meet you at SGF.  If you ever venture to Toronto, let me know and we can grab a bite!

Chris

by
on ‎04-15-2016 06:20 PM

I've spent way too much time investigating dice in a number of ways, sums of different sizes of dice, (anywhere from 4 to 100 sided, actually just about any uniform discrete probability generator), combinations of different sizes, rules like sum of 3 largest of 4 dice. Differences in means and spread of the sum of 3 six-sided dice or best 3 of 4 and similar.

For added fun look into a game such as the classic Risk (and the later versions with additional modifiers) that involve sequences of outcomes comparing top values rolled by one player versus the top rolled by the other.

Unlikely to get to any of the Toronto's I'm familiar with but maybe my employer will relent on possible forum attendance in the future.

by
on ‎04-15-2016 07:02 PM

I loved Risk when i was a kid, but was hardpressed to find anyone to play.  Definitely math is highly important; wondering if anyone has done a mathematical analysis of D&D <geek grin>.

I should have specified - i'm in Toronto Canada :-)  Keep forgetting there's a couple of them in the US.

Chat soon!

Chris

Contributors