BookmarkSubscribeRSS Feed

Dynamic report summaries in SAS Visual Analytics

Started ‎10-24-2018 by
Modified ‎10-24-2018 by
Views 2,774

Have you received an e-mail with a link to a report and have no idea what the report is about or what information it contains? Perhaps you get the same link once a week or month and you just don’t have time to keep accessing it to find out if action is required? Wouldn’t it be more effective if along with the link to the report you received an insightful summary?  One that would quickly highlight any recent changes or key findings.  Dynamic summaries are now available with SAS Visual Analytics using Apache Velocity syntax! Now report authors can include key findings in a summary for the report they are sharing. This summary can be previewed in SAS Drive, report distribution e-mails, in SAS Report Viewer and SAS Visual Analytics Apps.  Because these report summaries, are easily read by screen readers they are beneficial for individuals with visual impairments.

 

Let’s look at how this would work.

 

Here we have a scrolling report that shows consumers with high water usage along with various water quality metrics over specified time frames.  We are currently looking at the most recent data.

 

Dynamic Summaries 1b.png

 

Under the report Options, when you scroll to the bottom, you will see a Summary box. This is where we’ll input our summary.

 

Dynamic Summaries 2.png

 

 

 To start with we’ll just enter a simple summary of the report.

 

Dynamic Summaries 3b.png

 

 

 

 If we click on the Preview Summary we can see how this will appear in text as well as speech (for accessibility purposes).

 

Dynamic Summaries 4b.png

 

 

This summary is ok, but it doesn’t provide any specifics about the numbers or results.  Let’s add some metrics to our summary.  I’ll add some additional text “The top water consumer is property”.  Then I’ll click on the arrow under the Summary box so that I can click on the value I want to display from the report.

 

Dynamic Summaries 5c.png

Information.png

Example of elements or labels you can select: cells in a list table, bars in a bar chart, slices in a pie chart, axis labels and object titles.  The references to data element values are based on the structure of the object. For example, if you select the first bar of a bar chart, then the summary always displays the value of the first bar in the bar chart.

 

 

One of the metrics I’d like to include in my report is the top water consumer, so I’ll use the bar chart located on the Benchmarking and Ranking tab of my report to select that value.

 


Dynamic Summaries 5b.png

 

After clicking the arrow next to the Preview Summary button, I clicked on the top bar from the Top 10 Properties – Total bar chart and select Property Name so the name of the property appears. 

 

Dynamic Summaries 12.png

 

If I had selected Total I could have the total water consumption displayed instead of the property name.  SAS automatically created the reference for it in my summary. Because the reference to the data element values is based on the structure of the bar chart the value shown will always be the first bar in the chart. This means that next month if a different property becomes the top consumer it will be listed in the summary and not property 163.

Dynamic Summaries 13.png

 

If I click on Preview Summary this is what appears:

 

Dynamic Summaries 14.png

 

Even though our property number looks like a numerical value, it was formatted as a character. Let’s now look at how numerical values will appear. 

 

Here is the Water Quality Monitoring section of the report:

 

Dynamic Summaries 15.png

 

 Let’s add “The specific conductance at 6 feet of water this month is” and add the numerical value from our key value object. 

 

 

Dynamic Summaries 16.png

 

After entering the text and clicking on the arrow, I’ll click on the specific conductance key value object in my report.

 

Dynamic Summaries 17.png

 

Here is what the summary looks like now:Dynamic Summaries 18.png

 

Note: numbers are not formatted in the velocity template. If you want to just show the integer value we can use intValue(). You can also use the velocity template $NumberTool to format the number. 

 

First, to make the code easier to write, let’s set a variable called foo (it can be any name) to equal our specific conductance key value. To do this we’ll type #set ($foo=["Current Specific Conductance Key Value"]["Specific Conductance 6ft"][0]), then we'll display our foo value but only the integer part and not the decimal value.  To do that we'll add $foo.intValue() to our summary. 

 

Note: make sure you use the arrow to select the specific conductance key value (the text italicized). Also, make sure there are no extra spaces in the text. The text should read #set ($foo=["Current Specific Conductance Key Value"]["Specific Conductance 6ft"][0])$foo.intValue()

 

The results are now this:

 

Dynamic Summaries 18b.png

 

 

Did you notice that the key value object for specific conductance had a display rule applied to it (i.e. the number was red)?  This means that the specific conductance was below its threshold (note: the lower the specific conductance the poorer the water quality is). To make this summary more valuable let’s provide an alert and warning text if the specific conductance falls within a certain range. To do this we’ll use the following Apache Velocity syntax.

 

 

#if( ["Current Specific Conductance Key Value"]["Specific Conductance 6ft"][0]< 216 ) **Alert! Specific Conductance is below threshold. Action Required.**

#elseif ( ["Current Specific Conductance Key Value"]["Specific Conductance 6ft"][0] >= 216 && ["Current Specific Conductance Key Value"]["Specific Conductance 6ft"][0] lt 232) Warning, Specific Conductance is getting close to threshold. 

#end

 

Note: Notice how I used >= in one instance and lt in another. This was to show you that you can use either format. 

 

This code will add the text "**Alert! Specific Conductance is below threshold. Action Required**" if the specific conductance is less than 216.  But when the specific conductance is between 216 and 232 the text displayed will be: "Warning, Specific Conductance is getting close to threshold".  

 

Dynamic Summaries 20b.png

 

 

Let’s test out our syntax.  Here we have our report that is showing a value of 202 (a number less than 216) for the specific conductance.Dynamic Summaries 19.png

 

Clicking on the Preview Summary button shows us the speech text.

 

Dynamic Summaries 21b.png

 

 

 

Now, let’s test out another condition of when the specific conductance is between 216 and 232.

 

Dynamic Summaries 22b.png

 

 

To make the coding more manageable, we could use the variable that we defined in the beginning, foo, in place of the full syntax for the specific conductance value.  Here is the same example but using foo.

 

 

Dynamic Summaries 24.png

 

So, now that we have a more insightful summary who gets to see it? One of the ways to see the summary is with the viewer (this is how most end users will access the report). From the viewer the user would select the More options menu and select Show summary.

 

Dynamic Summaries 29.png

This is what the summary will look like from the report viewer.

 

Dynamic Summaries 30.png

 

The summary can also be viewed in SAS Drive. From SAS Drive we’ll click on the Actions menu for the report then select Preview.

 

Dynamic Summaries 25.png

 

 

 

In Preview mode you’ll see the summary are the bottom of the screen. In our case, we’ll have to scroll through it.

 

Dynamic Summaries 26.png

 

Not only can you see these summaries in SAS Drive and the report viewer, but the end user will also see them when you e-mail the report or set up report distribution.  When you distribute the report, you will see an option to include the summary or not.

 

Dynamic Summaries 28.png

 

 

I hope this blog has shown you how the dynamic summaries can provide valuable information to the end users.  Have fun testing out different Apache Velocity syntax! Let me know what other fun things you can produce! 

 

 

Version history
Last update:
‎10-24-2018 12:15 PM
Updated by:
Contributors

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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 Labels
Article Tags