A Graph for Trump -- Our Oldest President


Recently, my fellow SAS blogger Rick Wicklin wrote a post showing how to graph the ages of all the US presidents. And Chris Hemedinger showed how to create a bar chart showing the number of presidents having each of the 12 zodiac signs. Both are interesting graphs, but I wanted to take a slightly different (more traditional) graphical look at the data -- something more along the lines of a histogram. This would let me view the age distribution of all the presidents, and confirm whether or not Donald Trump is the oldest.

For me, creating a graph is an iterative process. I start simple, and then add little changes & enhancements (wash, rinse, repeat), until I have a visualization I'm happy with. Rather than just showing you the final graph, I'm going to walk you through my entire though process this time ...

I started with a simple Proc Gchart bar chart, using all the defaults. It produced a fine histogram, showing the number of presidents grouped by age, and I could see that 3 presidents were in the '70' age group. I knew Trump was 70, and I had heard he is going to be our oldest president ... but there appear to be two other presidents in the 'age 70' bar in this graph. I think I need to dig a little deeper...

I used the subgroup option, to create a separate colored bar segment for each president, to determine who the other two were. In theory, I could match the colors in the bars with the colors in the legend and determine the other two presidents' names ... but it was really a chore to try and distinguish all those colors. To save you a bit of time, I've used a drawing package and circled the legend items that correspond to the colors in the '70' bar (Trump, Reagan, and Harrison).

44 is a few too many colors for a legend -- no, actually it's a ridiculous number of colors. Therefore I used a pattern statement to repeat a single color for all the bar segments. Then I used Gchart's 'html=' option to enable html mouse-over text. With that enhancement, I could hover my mouse over each bar segment and easily see not only the name of each president, but also their age at inauguration.

With the mouse-over text, I found that the other two presidents in the '70' bar were both slightly less than 70. Gchart bars of numeric values show the midpoint of each bar in the label, by default. In order to show the range of values in each bar (min-to-max), you must specify the 'range' option. With that change, it was much more clear that the last bar didn't show the presidents who were 70 when they were inaugurated, but rather the ones who were >=68.

These automatically chosen ranges were nice and evenly-spaced, but they weren't really the ranges that I would have picked ... therefore I decided to go totally custom, and do my own binning. I used a data step and 'if' statements to check each president's age, and assign them to 7 bins, representing age ranges that start and end on even multiples of 5. I then created a user-defined-format so that those ranges (1-7) would show up as the text representation of the ranges (such as '>=70'). The resulting graph clearly showed that Trump was the only president >=70!

Now that I had the layout the way I wanted, I shifted my focus to the cosmetic details. I made the bars a prettier shade of blue, cleaned up the axes, added some reference lines, and annotated the presidents' names on each bar segment (here's the final code). The results might not be perfect, but it's what I would call a blue-ribbon graph! Click the image below to see the interactive version, with html mouse-over text and drill-downs.

pres_ba5

Quick quiz:

Which last names are repeated multiple times in the graph?

What's the youngest and oldest ages allowed to run for president in the US?

Robert Allison, The Graph Guy!, SAS

Robert Allison has worked at SAS for more than 20 years and is perhaps the foremost expert in creating custom graphs using SAS/GRAPH. His educational background is in computer science, and he holds a BS, MS, and PhD from North Carolina State University. He is the author of several conference papers, has won a few graphic competitions, and has written a book calledSAS/GRAPH: Beyond the Basics.

People Using Smartphones While Driving: The Numbers Are In

Are you texting while driving? Here's a look at distracted drivers by state.

Airlines Involuntarily Bumping Passengers: A Look at the Data

Airlines bumping paying passengers is an issue that has gotten a lot of attention recently. Here's a visual representation of how often it happens.


Re: Our aging country
  • 12/26/2016 11:46:55 PM
NO RATINGS

kq4ym, that's the beauty of the US Constitution, right ... it's vagueness. It doesn't get into specifics about the temperament of the country at the time of writing, or any time, and it doesn't delve into technology. The most specific it gets is at its lowest point -- the 3/5 clause. And that's certainly been derided into history and not actually used in today's world. That leaves something with enough wiggle room to make it relevant and workable in most any America.

Re: Our aging country
  • 12/26/2016 11:06:26 AM
NO RATINGS

It would be an interesting study to determine just what should be included in national Constitituions and laws that might stand the test of time. Could there be a consensus made today that would be different that those folks of 1776 and jjust what principles might be much different today considering our technical changes and indeed maybe philosophical variance from the past?

Re: Our aging country
  • 11/30/2016 2:09:41 PM
NO RATINGS

Magnetic North I think when our founding fathers crafted the constitution they could not have predicted where we are today from a technology perspective and medical perspective.  I don't see anything wrong with applying some of the criteria we all have to meet to any government official. Their failure is more impactful than many of ours because it could impact and entire state in the US or a country.

Re: Our aging country
  • 11/30/2016 9:32:31 AM
NO RATINGS

@impactnow I suppose the difference is easily in that employment and leading in a democracy are two very different things. Here in the Philippines, any natural-born citizen, a resident of 10 years or more, at least 40 years old, a registered voter, and able to read and write is allowed to apply for presidential candidacy. Many blue collar jobs here even require a high school diploma and the presidency does not. The hiring process of a company and a nation are very different, simply because the employers and their aims are fundamentally different. I don't think you can add much to the requirements for presidency without deviating drastically from democratic principles.

Re: Our aging country
  • 11/29/2016 8:59:27 PM
NO RATINGS

Seth I find it very interesting that most of us go through a more rigorous background check health screening and other tests that ourCommander-in-Chief. One thing the most recent election has taught us is that our processes are filled with opportunity for evolution . I hope this interest in politics that has gripped our nation after the election becomes the impetus for change.

Re: Our aging country
  • 11/29/2016 8:40:10 PM
NO RATINGS

@ impactnow. - I would one up that and also suggest a mental health exam and a logic test.  I'm fairly certain that certain President elect might have a border line personality disorder. 

Re: Which Roosevelt?
  • 11/28/2016 1:31:07 PM
NO RATINGS

Although as noted there's really not enough of a sampling to determine some answers, it would bge interesting to see how true it is that most all Presidents are wealthy men and just how a more modest background might compare to the chief executive with all the advantages of best schooling and a wealth background.

Our aging country
  • 11/28/2016 12:15:49 PM
NO RATINGS

As America ages and life span extends I wonder if Trump will be our oldest President or if we will see older presidents in the future. Both Hillary Clinton and Trump were older candidates who is years past might not have run due to health issues or other concerns. I do believe that all Presidedns should have to be declared fit for office prior to inauguration, many of us go through very rigorous checks including drug screening, physicals, and credit checks to take jobs of less worldwide impact.

Re: Which Roosevelt?
  • 11/23/2016 11:07:47 AM
NO RATINGS

Not sure we have an adequate diversity in this sample size to warrant trend seeking. They're mostly all older, rich and white. Outliers like Obama (because of race and upbringing) and Lincoln (because of upbringing) might be interesting to study to see if they bring uncommon wisdom to their role because of their uniqueness. But that's not exactly what you're looking for.

Re: Which Roosevelt?
  • 11/23/2016 1:00:15 AM
NO RATINGS

That makes sense that the median age is around 55 since the average lifesplan was that long through out U.S, history.  I would except it would increase as life span averages increase.  

Page 1 / 2   >   >>
INFORMATION RESOURCES
ANALYTICS IN ACTION
CARTERTOONS
VIEW ALL +
QUICK POLL
VIEW ALL +