BookmarkSubscribeRSS Feed

How to customize your SAS Visual Analytics report: Part 3 - Create a dynamic title

Started ‎12-09-2016 by
Modified ‎12-09-2016 by
Views 7,387

This is my third article in a series of three that walks through different ways to customize your SAS Visual Analytics report. Check out the first entry on creating a custom graph and second article on augmenting data with custom categories

 

As I mentioned previously in this series, creating reports in SAS Visual Analytics is a very iterative process.  You start by building a graph, make incremental changes, review, make additional changes and so on.  This last entry will focus on how to create a dynamic title for your report. 

 

We start in Report Designer by building a simple Dual Axis Bar-Line Chart.  The roles are defined as :

 

  • Category - [PresidentialOrder]
  • Measure (bar) - [Length of Presidential Term] (green bar)
  • Measure (line) - [Age at First Inauguration] (blue line)

Sort the chart by Presidential Order in ascending order

 

Note - If you are using the companion SAS data set provided for these exercises, Presidential Order was changed from Measure to Category before adding it to the above chart.  This is an example of how simple and straight forward it is to change the characteristics of your data.

 

 

3a-1.png

  

One item that jumps out at me is that president number nine had an extremely short presidency (William Henry Harrison died after 31 days in office).  But the graph is incomplete ... that is, unless I knew the name of president number nine, I would be left wondering.  A visualization should never leave the user guessing what something means.  A simple solution is to add a dynamic title that changes when the user selects a bar.

 

How to create a dynamic report title

We will use the Button Bar to display the dynamic title in the existing dual axis bar chart

 

  • From the Report Designer, click on the Objects tab
  • Drag in the Button Bar control
  • Click on the Data tab
  • Add President to the category
  • Remove Frequency from the Frequency role (otherwise it will show up in your “title”)
  • Create an interaction by clicking on the Interaction tab on the right pane
  • Click on the Interactions View
  • Hover over the Bar Chart until the arrow changes to a pencil
  • Drag a line from the Bar Chart to the Button Bar
  • Click Close
  • There is now an interaction, where clicking on an individual bar (or point on the line) will dynamically change the selection of the button bar

 

3a-2.png

 

Now when you select an individual bar, the title will dynamically change to your selection.

 

3a-3.png

 

The result is much better.  A user can interact with the report and immediately know what president has been selected.  But as the report currently exists, there is a limitation that can easily be fixed.  If you deselect your selection on the chart, ALL the presidents show up in the button bar, which is extremely busy, as well as confusing.  We can change this by creating a rank (on the button bar) for the category President, and showing the Top Count of 1, by frequency.  Also, deselect ties, otherwise all presidents with a frequency of 1 will display.  Now if you deselect your selection on the chart, only one president will show up in the button bar. 

 

3-4.png

 

And don't forget you can always change the font, background color, etc. by clicking on the Styles tab on the right and making the appropriate changes.

 

This dynamic title helps to give more information about the report.  But what if we want to add even more information to the report title?  What if we want to include not only the name of the selected president (category), but also their age when first inaugurated (measure)?

  

How to combine text and measures in a dynamic title 

To create a dynamic title with a combination of category and measure, we will need to create a calculation, and then apply that calculation to the button bar.

 

  • In Report Designer, click on the Data tab
  • Click on the 1-1.png and select “New Calculated Item”

 

3-5.png

 

  • Name the Calculation “Dynamic Title”
  • Drag in the Concatenate operator (either search for it or find it under Text-simple)
  • Drag in President from the Character Data Item
  • Type in “ was” in the second operator
    • Note - there is a space before and after “ was ” so the dynamic title displays properly
  • Drag in Concatenate one more time
    • Note – when you drag in concatenate again, you will want to add it to the end of your existing expression. To do this, before dropping it on the workspace, hover over the bottom right of the existing expression.  This will wrap the text at the end of your existing expression.

 

3-6.png

 

  • I also want to bring in a number (age). The Concatenate operator expects a character, but the age is a numeric measure.  We can do this with the Format operator.
  • Drag in the Format operator (either search for it, or find it under Text-simple)
  • Now you are able to drag in the measure “Age at First Inauguration” without error
  • Format it as appropriate (I used comma2 and 0 decimal in my example)
  • Drag in Concatenate one last time
  • Type in “When First Inaugurated as President of the United States”
    • Once again, make sure there is a space before your text begins

 

Belows are images of the formula, in both Visual and Text mode:

 

 3a-4.png

 

3a-5.png

 

  • Replace the Category of the Button Bar to the new calculation “Dynamic Title”
  • Add a new Rank for Dynamic Title, to Top Count of 1, based on frequency
  • Now when you select a president from the bar chart, the title dynamically gives you the name AND age of the president, along with some other text. In the example below, selecting on president 16 (Abraham Lincoln) shows the following title.

  3a-6.png

  

Dynamic titles are a very powerful feature that increases your users understanding of a report.  I hope you are able to leverage them in your reports.  Happy Visualizing!

 

Comments

Hi Steve,

 

I tried to create button bar to create dynamic title and I am not getting a option to create interaction from Dual line bar chart to this button bar. Could you please guide me ..!

Version history
Last update:
‎12-09-2016 10:11 AM
Updated by:
Contributors

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags