PROC REPORT versus other Base SAS procedures

PROC REPORTWhen you’re making a report, how do you choose which procedure to use?  The answer is – it depends.

It depends on:

  • whether you are doing an ad hoc analysis or creating a final report that many people will see
  • whether you will run statistical tests with your data or if you just want to see it
  • your level of comfort and if you already have working code

Most of my work involves creating final reports that will be distributed to many users.  I am a PROC REPORT specialist, so 90% of the time, I use PROC REPORT to create these reports.

Here is why:


PROC MEANS is a wonderful, powerful procedure in its own right.  It is an excellent tool for creating data sets of statistics that get fed into DATA steps or other procedures.  I use PROC MEANS extensively, but not as my final reporting procedure.


  • give me percentages
  • do traffic lighting
  • add, subtract, multiply, or divide two variables
  • create new variables

PROC MEANS can give you an overall total and a total for CLASS and BY variables, but so can PROC REPORT.


PROC FREQ is really good at creating a small data set of counts that I can use later.  It is a very quick way of calculating percentages, which might be easier than trying to calculate them in PROC REPORT.  However, starting with PROC REPORT is better for me, just in case I am asked to make changes to the final output and the changes require something that PROC FREQ can’t do.

PROC FREQ does not:

  • support the STYLE option, so I can’t apply traffic lighting
  • calculate simple statistics, like median or mean
  • add informative text

Read More »

Post a Comment

Things to do in Vegas during SAS Global Forum

While you're at SAS Global Forum (or any conference) in Las Vegas, you might have a bit of spare time to do some sightseeing. Therefore I've put together a list & map of interesting things you might want to experience!

Below is a snapshot of my map - click it to see the full size interactive map, with hover-text and drill-downs for each attraction. Notice that the marker for the main conference hotel is yellow/red, and the other attractions are cyan/blue. You can click the markers to launch a Google search for that attraction, and the hover-text for each marker shows the distance from the conference hotel (I tried to pick interesting attractions within a reasonably short distance). The interactive map is followed by a tabular list of the attractions, if you're more of a text-based person.  


Technical Details: Read More »

Post a Comment

The road to SAS Global Forum: A training Q&A with the SAS Jedi

The journey continues as we hear from the instructors for each of the courses being offered on Thursday and Friday, April 21 and 22 after SAS Global Forum.

Next up is Mark Jordan who developed and will teach the Introduction to DS2 and Hadoop course.

  1. Why should people get excited about this course?

Are you good with SAS but new to Hadoop and wondering how they fit together? Learn enough Hadoop to get you started and enough about DS2 to supercharge your data preparation programs – and get a little hands-on experience along the way! DS2 is a new SAS programming language that integrates the power and control of the DATA step with the ease, flexibility and rich data type palette of SQL. Like so many things in SAS, DS2 plays well with many data sources, but it is exceptionally well suited for manipulating data on massively parallel platforms (MPPs) like Hadoop and Teradata.

Learn how DS2 gives you the power to:

  • Process traditional SAS data sets and data tables containing full-precision ANSI data types in the same DS2 DATA program
  • Easily create and share reusable code modules using DS2 packages
  • Safely and easily parallel process multiple rows of data simultaneously using DS2 DATA and THREAD programs on the base SAS platform. You’ll need nothing but base SAS!
  1. Who would get the most out of attending this course?

Read More »

Post a Comment

Speak up! The Analytics Experience is opening its call for content

AX2016speakerThe Analytics conference series is getting a modern makeover. And it’s not just a new name.

The Analytics Experience, Sept. 12-14 at the Bellagio in Las Vegas, is bringing thought leaders and analytics gurus together for one big event. So whether you’re a geek or a suit you can create a custom conference experience that delivers thought leadership, analytics strategies, learning and connecting.

Another big change happening this year is that we’re opening a call for content. Are you interested in presenting, but want to know what’s in it for me? Here are the top 3 reasons why you should consider presenting at Analytics Experience.

  1. Show off your work

Why wouldn’t you want to show hundreds of your peers the awesome advancements you’re making in the analytics space? Speaking boosts not only your credibility but also your company’s credibility. Read More »

Post a Comment

Drug overdose deaths are on the rise in the US

Lately I've seen several articles about drug overdose deaths being on the increase. But I didn't really like the graphs in those articles, so I tried to create some better ones using SAS ...

For example, here's a map from the National Center for Health Statistics website (see the 3rd dashboard/tab above the images). I've seen it used in many articles (such as here and here), but I really don't think it's a great map. For example, the odd map projection (the western states look squished), and placement and size of Alaska and Hawaii - none of these physical aspects of the map are what I'm accustomed to seeing. I also don't like that they used a diverging color scheme (red to blue) - this might be appropriate for quintile color binning (where a different color is assigned to 1/5 of the land areas), but in this case sequential/linear binning was used with each color representing an additional 2 deaths per 100,000. Also, 11 colors were used in the legend - this is really too many colors for someone to easily discern, and relate from the map to the legend. And there are no state outlines, therefore it is difficult to determine which state a specific county is in.

nchs_mapI located the raw data in csv format, and was happy to find that it imported easily & cleanly into SAS using Proc Import. The data was pre-summarized into the 11 bins used in the NCHS map (above) - but 11 is too many colors to easily discern, and therefore I combined bins such that there were only 6 colors. I then plotted the data on a map using Proc Gmap (using a standard/familiar projection), and used a color gradient with shades of red (rather than using shades of 2 diverging colors like the map above). For a finishing touch, I overlaid the state outlines on the map. You can click the image below to see the interactive version with html hover-text, so you can see the names & values of each county:

While looking for the data, I happened to come across another visualization that let you see the trend over time, by showing 12 small maps on 1 page (small multiples). Below is a partial screen-capture (the whole grid is a bit wide, and would require too much shrinking to fit into the blog format - but you can click the image to see the full-size example). This map also used a diverging color scheme (blue-to-red), was a bit too small to really see the data at the county level, and lacked state outlines.

Read More »

Post a Comment

The road to SAS Global Forum: A training Q&A series


David Ghan

The journey continues as we hear from instructors for each of the courses being offered on Thursday and Friday, April 21 and 22 after SAS Global Forum.

Our next stop is with instructor David Ghan who is teaching the Using SAS® Programs to Execute Pig and HiveQL in Hadoop and Efficient Programming Methods Using the SAS/ACCESS® LIBNAME Connection to Hadoop courses.

1. Why should people get excited about these courses?

These two courses are exciting because, as a SAS programmer, you can learn how to use SAS programming skills to process and analyze big data in the Hadoop platform and still leverage the infrastructure Hadoop provides to process large volumes of data quickly.

In the Using SAS® Programs to Execute Pig and HiveQL in Hadoop course you are introduced to open source Hive and Pig techniques for working with data in Hadoop and how to leverage that knowledge by integrating those techniques within SAS programs.

You’ll learn to work within the framework of the SAS language and still access the native capabilities of the Hive system for processing the data within the Hadoop cluster in the Friday offering of Efficient Programming Methods Using the SAS/ACCESS® LIBNAME Connection to Hadoop.

2. Who would get the most out of attending this course?

Read More »

Post a Comment

Jedi SAS Tricks - Variable Names to Values with VNAME

"What's in a name?" asked Juliet. "That which we call a rose by any other name would smell as sweet." What if it's not roses we're after, but variable names which hold the values needed for a calculation?
Read More »

Post a Comment

Best gasoline prices for your holiday travels

Gasoline prices are a lot lower than they've been the past few years, but the price fluctuates so much that it's difficult to tell whether you're getting a good deal. Perhaps these SAS graphs & maps will help you get a handle on it, so you'll know a good deal when you see one!

If you're like me, and have a Prius for a daily driver, your trips to the gas station are so infrequent that you might not really be conscious of what the gas prices should be. But if you're going to be doing a lot of driving during the upcoming Easter holiday and spring break, you could save a few bucks by being in-the-know.


One factor to consider is the time of year. Typically, unless there are other factors such as wars, or supply shortages, etc, gasoline prices go down in the winter (mostly because of reduced demand & less driving). Therefore gasoline prices usually drop in December/January/February, and start to rise in March. You can see this in the graph of weekly gasoline prices below - the vertical reference lines are at Jan 1st, and you can see the gasoline prices dip at many of those reference lines:


If you're driving through different states, you should be aware that gasoline prices can vary widely from state to state. The main reason for this is that the different states charge different amounts of taxes. If you schedule your fill-ups in the states with lower taxes, you can save some money! Here's a graph showing how much taxes each state adds to their gasoline price:


The difference in taxes is a pretty good indication of which states might have lower gasoline prices, but the thing we really want to see is the actual gasoline price! And what better way to see that, and plan your routes & gasoline stops, than a nice simple map ... Read More »

Post a Comment

The road to SAS Global Forum: A training Q&A series 2

Lynn Matthews, SAS

Lynn Matthews

We continue to ready ourselves for this year’s SAS Global Forum coming up next month. On Monday, April 18, there will be two SAS Certification testing events. Then after the conference wraps up, SAS training instructors will be offering unique, hands-on training that you won’t find anywhere else. In this Q&A series, hear from the instructors for each of the courses being offered on Thursday and Friday, April 21 and 22.

Our second stop is with instructor/developer Lynn Matthews who has written the Using SAS® Visual Analytics Explorer and Using SAS® Visual Analytics Designer courses.

  1. Why should people get excited about these courses?

If you are taking Using SAS® Visual Analytics Explorer you’ll learn how to interact with the environment via the SAS® Visual Analytics Home Page and learn how to explore data using SAS® Visual Analytics Explorer.

Students taking Using SAS® Visual Analytics Designer will learn to interact with the environment via the SAS® Visual Analytics Home Page and learn how to create reports using SAS® Visual Analytics Designer.

  1. Who would get the most out of attending this course?

Read More »

Post a Comment

Does E85 fuel save you money or cost more?

I recently bought a vehicle that has FlexFuel capability and can use E85 (mostly ethanol) fuel. But can you guess whether it is more economical for me to use E85, or regular gasoline? Read the SAS analysis below to see if you guessed right!

I've been the happy owner of a 1995 Jeep Cherokee for 21 years. I used it to haul DJ gear, pull trailers, and transport kayaks & canoes on top. It never left me stranded, and has been my favorite vehicle.


But, as my hobbies have grown, so have my vehicle needs. The Cherokee just won't hold all the DJ gear I want to take when I play music for a car show. And I don't think it could safely tow my 30-ft boat. And although it's never broken down, it's getting too old for me to trust with a high degree of certainty on a long trip. So I studied the used car market for several weeks, and decided that a Chevrolet Suburban would be the perfect special-purpose vehicle (to go along with my Prius daily driver). So I got a 2007 Suburban LS 4wd, with the 5.3 liter v8 engine - it's got twice the space & twice the horsepower of my Cherokee, and is 1/2 the age!


The Suburban is FlexFuel capable (meaning it can use E85 fuel), and the previous owner mentioned that he had recently filled it up with E85, since it cost less than $1.50/gallon (about 30 or 40 cents cheaper than regular gasoline). But I wondered if it was really a better deal, since you get fewer miles per gallon with E85. So of course I decided to analyze this question using SAS software ...

The Analysis

First, I needed to collect a bit of data. I went to the website and looked up the mpg for my Suburban using regular gasoline and E85 (16 & 12 mpg). I used to find the price of regular gasoline near me in the 27513 zip code area ($1.84/gallon at the Shell station nearby). Gasbuddy doesn't track E85 fuel prices, so I went to the government's alternative fuels database center, and found the closest station selling E85 (which was a Sheetz station in Raleigh). The database didn't list prices, so I called the Sheetz station, and the manager was kind enough to go outside and check today's price for me - $1.49/gallon.

Now let's analyze the data. First I plotted the fuel prices. I don't usually get 'cute' with my graphs, but I decided to fill the E85 bar with a corn-kernel image, so you can easily tell which bar represents the corn/ethanol fuel. We knew that E85 was cheaper than regular gasoline based on the price numbers, but the graph helps your brain visually compare them on more of a percentage basis.


Next I plotted the miles per gallon. We knew that 16 was more than 12, but the graph helps us see "how much more." Read More »

Post a Comment