Get the Data
With the Powerball Lottery in the US reaching astronomic levels recently, I wanted to see if I could find some data that we could play with; I found some for 2010-2015 for the State of New York, and wanted to play around with it. You can get the data yourself from http://catalog.data.gov/dataset/lottery-powerball-winning-numbers-beginning-2010.
I must admit, I manipulated the data slightly before bringing it into SAS. I split the winning sequences into individual columns, called First, Second, Third, Fourth, Fifth and Sixth. This allowed me to run the frequency etc., on the individual numbers themselves, rather than the group as a whole.
How to go about getting SAS University Edition
If you don’t already have University Edition, get it here and follow the instructions from the pdf carefully. If you need help with almost any aspect of using University Edition, check out these video tutorials. Additional resources are available in this article.
Getting the data ready
First, let’s look at a standard SAS Output; I’m doing a basic count by each of the numbers that were in the first position. If you’re unfamiliar with PROC SQL, feel free to browse the earlier articles on Free Data Friday.
Here’s what the output looks like:
Nothing we haven’t seen before, the Observation ID, the column headers, and the data. But as I mentioned, the point of this is to highlight ODS output, and that’s what we’ll do next.
ODS stands for Output Delivery System, and although a little tricky at first, once you get the hang of it you’ll find you’re using it for presentations, reports, publications, etc.
So let’s take a look at the code. You’ll notice that the PROC SQL from above has just been “wrapped” into another section of code, with a PROC PRINT at the end.
In this example (taken and modified from the SAS Snippet), I’m going to be generating an HTML file, a PDF and a EDF-like document called an RTF.
When you run the code and go into your Results tab, you’ll see three new buttons:
They are, in order, Download HTML, Download PDF, and download the RTF. Obviously you’ll select the most appropriate one for your needs, this is just to highlight SAS’s capabilities.
Here’s the what the downloaded HTML file looks like (which is the same as above, but is downloaded to your local machine):
Here’s the PDF output:
Finally, the RTF as it looks (unedited):
Although these initial outputs would not be suitable for you to show your boss, your colleague, or even your dog, the point of this was to show you the functionality and what’s feasible. In next week’s article I’ll start going into some of the more complex formatting and style options.
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.