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

Playing with Powerball data - ODS and outputting your data II

by Super Contributor on ‎01-29-2016 10:12 AM - edited on ‎01-29-2016 01:45 PM by Community Manager (512 Views)

Although I am focusing on ODS in this series of posts, I’m going to diverge slightly and use this post to talk about a cool feature that is intertwined with ODS, but not necessarily an actual component of it. I realise this is a post in the Free Data Friday series, but for the purposes of this article I’m going to use the Powerball data from last week to pick up where I left offLottery.jpg


As I have mentioned before, the intention of data analysis is to share your findings; although colour and fonts don’t have to be used to do this, humans are for the most part visual.  Therefore, having something a bright red will irritate most people and cause them to stop and actually notice.  This is an automatic reaction, and so having your results displayed with colours could make your report or presentation that much more effective.



I want to focus on adding flare and style to your output.  I’m going to use the PDF output, as it’s my personal favourite, but feel free to use the RTF or HTML when you’re playing around. 


We are going to do is modify the code from last week ever so slightly:



The only addition is the style option in the first line; but we’ll get to more about that in a second.  I’m using the Harvest style and here’s what it looks like after I’ve run the code and downloaded the PDF:




Note that the output in SAS University Edition’s Results window looks the same; that’s because the style option only applies to the PDF.


So you may be asking if there are other styles; of course!  SAS provides you with a wide variety of styles to choose from.  If you open a new window and run the code below, you’ll get a full list of the different styles available.






The image above is what you’re going to get, which is a list of 58 different styles that you can choose from.  Although handy, it’s not very informative – “Raven”, “HTMLBlue” and “Journal” don’t really give you a sense of what they look like.  There is a great document on the www.sascommunity.org site – you can find it here.  It’s for 9.2, so there are some differences (with 1 page per style, it’s 52 pages versus the 58 styles available in 9.4).  FreeDataFriday_graphic.jpgI’d suggest going through them and seeing the different styles; you may not find anything you like, but it will give you an idea of what’s possible, and that is what’s important.


So what happens if you don’t see any styles in the list that SAS provides that will work for your needs?  What if I told you that you can create your own, using a variety of different processes?  The one I’m going to show you is the easiest, and the first that I learnt.  It’s not as powerful as some other options (PROC TEMPLATE, for example) but this is pretty flexible. 


I’ve taken out the style=styles.Harvest statement at the top, and then instead of the PROC PRINT, I’ve replaced it with PROC REPORT, and the description of each is relatively straight forward:


Screen Shot 2016-01-28 at 7.50.44 PM.png


I’ve specified (obs=5) because I only want the first 5 rows returned.  I’ve specified the styles I want applied to the Report Background, Column, Header, Summary, and Lines. The col statement specifies which variables I want to include (because the dataset has only two, it makes the decision easy) and then I want to sort by the column I have called “first”. 


Here’s the output in the Results tab:




And here’s what the PDF looks like:




OK, so it’s not pretty but it highlights the flexibility and ease with which you can create your own style!


I'm hoping you have a chance to play with the different styles - hopefully you'll post what you create here!  


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!



Your turn
Sign In!

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

Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.