We’re smarter together. Learn from this collection of community knowledge and add your expertise.

Playing with Powerball data - ODS and outputting your data

by Regular Contributor ‎01-22-2016 07:32 PM - edited ‎01-23-2016 10:43 AM (240 Views)

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.FreeDataFriday_graphic.jpg

 

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

 

Image_1.PNG

 

Here’s what the output looks like:

 

Image_2.PNG

 

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.

 

The Results

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.

 

Image_3.PNG

When you run the code and go into your Results tab, you’ll see three new buttons:

 

Image_4.PNG

 

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):

 

Image_5.PNG

 

Here’s the PDF output:

 

Image_6.PNG

 

Finally, the RTF as it looks (unedited):

 

Image_7.PNG

 

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:

 

Search.PNG

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:

 

Image_9.PNG

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

 

Happy Learning!

 

 

 

Your turn
Sign In!

Want to write an article? Sign in with your profile.