BookmarkSubscribeRSS Feed

SAS Visual Analytics Display Rules: Table – Level

Started ‎05-11-2023 by
Modified ‎07-19-2023 by
Views 1,650

This is the second post in a series about the available Display Rules in SAS Visual Analytics.

 

  Recall from the first article, that there are three types of display rules. Here are examples for each type.

 

  • Color-mapped Value: based on a Category data item.
  • Expression: based on a measure data item expression.
  • Gauge: based on a measure data item interval definition.

 

The conditions are defined in the Rules pane. These Boolean expressions are evaluated for each visualization based on the assigned data Roles.  

 

01_TypesOfDisplayRules_TableLevel.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

SAS Documentation: Working with Display Rules.  

 

Table – Level

In this article, we will cover the Table – Level Display Rules. There are two types of table objects in SAS Visual Analytics, the List Table and the Crosstab. Here are the available Display Rule types that each table object supports:  

 

List Table Crosstab
  • Color-Mapped
  • Expression
  • Gauge
  • Expression

 

List Table

 

The List Table Object is one of the most feature rich objects. I cover several of these features in this article, Get to know the List Table. From the above list, we can see that the List Table supports all three types of Display Rules. Let’s look examples of each.  

 

List Table – Color-mapped Value Display Rule Here are the steps to define a Color-mapped Display Rule for a List Table:

 

  1. Select the target object in the report, in this example, the List Table Object.
  2. Then open the Rules pane.
  3. Select + New rule.
  4. Now you must select which category data item you want the Color-mapped Value Rule to be built from. As you can see from the screenshot, you can select Any Category or you can select a specific category data item. We will, in this example, select Product Line.

That means, this Display Rule color-mapped value condition will only be applied to the Product Line data item. This is different from a Report-Level color-mapped value condition as it is applied to any category data item in any data source in the Report. If I had selected Any Category in this rule definition, then it would behave similarly to the Report-Level where it would try to apply the rule for any category but only in the selected List Table and thus only the data source feeding the List Table.  

 

02_ListTable_Color-mapped.png

  

  1. Next, start typing the case sensitive string value. A list of available values will appear for the selected data item.
  2. Select the color to be applied when the display rule condition is true.
  3. And lastly, you will need to select the Placement of the rule.

 

In this example, my List Table only has two Roles assigned: Product Line and Profit. The available Placement choices will be to apply the coloring to the entire Row or only to a selected column.  

 

03_ListTable_Color-mapped.png

  

Here is how each of those Placement positions would look in this example List Table for a Color-mapped Value Display Rule.  

 

04_ListTable_Color-mapped-1024x492.png

  

List Table – Expression Display Rule To define an Expression Display Rule for the List Table Object, you start with the same steps:

 

  1. Select the List Table Object you want the Rule defined for.
  2. Select the Rules pane.
  3. Click + New rule
  4. Select either Any Measure or the specific measure data item to define the Rule for. In our example, we will select Unit Yield (rate). The measure selected can be a measure from the data source, a calculated data item or even an aggregated measure.

05_ListTable_Expression-1024x432.png

   

Next we must define the Display Rule Expression. Let’s walk through these steps.  

 

  1. Rule Type: Expression
  2. Label: This will display in the Rules pane when viewing the report.
  3. Operator: Select the Boolean operator to use when comparing the current aggregated value to the Value defined in the next step.
  4. Value: Type or select a value to use for the Boolean comparison. Notice that all of the measure data items and aggregated measures are available for selection. If defined, you could also select a parameter. For this example, I created an aggregated measure using the _ForAll_ context to use in this display rule, Unit Yield (rate) For All.
  5. Format: Next, select how you would like to style the object when the expression returns true. In this example, I will change the font color to be red.
  6. Placement: Like in the previous example, you may select how to style the object. If you would like the entire row styled or select an individual column from the assigned Roles.

 

06_ListTable_Expression.png

  

Here is how each of those Placement positions would look in this example List Table for an Expression Display Rule.  

 

07_ListTable_Expression-1024x761.png

  

Pro Tip: Notice that this List Table Expression Display Rule uses a column in the data source that is not assigned to the List Table Roles. This is an incredibly powerful feature of the List Table.

 

List Table – Gauge Display Rule

 

The Gauge Display Rule for List Tables adds an additional visualization in line with each row. There are four gauges to select from and the display rule allows for a custom interval definition. Here are the available gauge types:  

 

08_ListTable_GaugeTypes.png

  

Here is how to define a Gauge Display Rule

 

  1. Select the target List Table object to make it the active object.
  2. Open the Rules pane.
  3. Select + New rule
  4. Select the measure to use in the Boolean expression for the Display Rule. You can select Any Measure from the data source or you can select a specific measure. In this example, I have duplicated the Expenses measure data item several times and added the name of each gauge I will define a Rule for to the end in parentheses.

 

09_ListTable_Gauge.png

  

Now we must define the gauge expression:

 

  1. Rule Type: Gauge
  2. Interval definition. Use the overflow menu and select Recalculate. You will be presented with a default of 3 intervals with automatically populated Lower and Upper bounds based on the current data item’s minimum and maximum.
  3. You can adjust the number of intervals if you wish and manually overwrite the Lower and Upper bounds with a custom value.
  4. Next, you will need to define the color palette that corresponds to your interval definitions. Be cautious to not always use the default red, yellow, green coloring. In this example, we are visualizing Expenses, therefore the higher the value, the larger the expense which, in our case, is the less desirable outcome. Therefore the larger the value, the more "in the red" I want the gauge to display.
  5. Gauge type: Bullet
  6. Column for the gauge to be placed in. In this example, we will keep the gauge next to the data item it represents.
  7. Placement in our example will be to the Right of text. You can see that it can also be placed Left of text or Replace text entirely. If you choose to replace the text entirely, make sure the Column label indicates what the gauge represents.

 

10_ListTable_Gauge.png

  

Here are how all of the available gauges look for the same measure, Expenses, and with the same interval definitions.  

 

11_ListTable_Gauge-1024x231.png

 Crosstab

 

The Crosstab is our second Table Object available in SAS Visual Analytics. Similar to the List Table in its popularity, it has a different purpose when visualizing data. The Crosstab Object is able to present hierarchical data items in a visually attractive way. You can assign a Hierarchy data item to either the Rows or Columns or you can just add multiple category data items and the Crosstab will handle the hierarchical display. If you use a hierarchy data item then the expand, collapse, and drill navigations are available. The Crosstab also has Options to display Subtotals and Totals or switch the orientation of where the measures are placed.  

 

But let’s talk about the available Display Rules for the Crosstab Object. The Expression Display Rule is the only type of rule supported. Now, before you become disheartened, the Crosstab (and the List Table) Object has two Cell Visualization Options available that can be used to enhance each cell which both add richness to the visualization. See my blog, Use SAS Visual Analytics Cell Graphs to enhance List Tables and Crosstabs or my YouTube, Add Cell Graphs to List Tables and Crosstabs in SAS Visual Analytics, for additional examples.  

 

Back to our Expression Display Rule for the Crosstab. Let’s start with the final result for this one. Here you can see the Crosstab Object and below you can see the Roles and Rules panes.  

 

When defining the Expression Display Rule for a Crosstab, the option to define an intersection of where the rule is to be applied is unique to this object. This means that the Boolean expression will only be evaluated at the specified intersection and the display rule formatting will only be applied to those cells. If there is no intersection defined, then all cells in the Crosstab will be evaluated and formatted if they meet the display rule condition.  

 

12_Crosstab_Expression.png

  

Now let’s dive into the details. First up, is the cells that have the font color red. This Expression Display Rule is intended to color the font red if any of the cells are less than zero. To define this rule:

 

  1. Select the Crosstab to make it the active object.
  2. Open the Rules pane.
  3. Select the + New rule menu.
  4. Select Any Measure.

 

13_Crosstab_Expression-1536x586.png

  

Then you must:

  1. Label: This will display in the Rules pane when viewing the report. I like to use a label that describes the display rule: Less Than Zero.
  2. Operator: Select the less than sign.
  3. Value: Enter the number zero. Notice that you could select from one of the measures assigned to the Crosstab or a parameter.
  4. Specify Intersections: Leave this unselected. We do not want to specify an intersection for this rule, we want all of the cells to be evaluated and if true then have the display rule applied.
  5. Format: Select the font color you want to use to style any cells that are less than zero. In my example, I would like to style those red.
  6. Placement: The only available placement for this display rule is the Cell.

 

14_Crosstab_Expression.png

 

In the screenshot below, I’ve used a red square in the first row to show how all of the cells where the display rule evaluates to true, the font color is now red. This applies to all cells, regardless of the intersection.  

  

15_Crosstab_Expression.png

  

Now let’s take a look at one of the display rule definitions for a specified intersection. You can then repeat similar steps for the other display rules in this example. Notice this time we select Expenses and not Any Measure.  

 

  1. Select the Crosstab to make it the active object.
  2. Open the Rules pane.
  3. Select the + New rule menu.
  4. Select Expenses.

16_Crosstab_Expression-1536x586.png

  

In this display rule, we will have to specify an intersection.

 

  1. Label: This will display in the Rules pane when viewing the report. To represent this rule I will label it Greater Than 500K.
  2. Operator: Select the greater than sign.
  3. Value: Enter the number 500,000. Notice that you could select from one of the measures assigned to the Crosstab, a parameter, or an individual value of Expenses from the data source. Recall that when we selected Any Measure we were not presented with individual values, but we are when we select a measure data item.
  4. Specify Intersections: In this example, I want the inside cells to be evaluated for this display rule. From experience, I know that this is the most detailed intersection, with both row and column data items selected: Facility Region / Product Line / Date by Year / Date by Quarter. The great thing about this, is after you select an intersection and need to change it, you can easily edit the display rule. So sometimes this is a trial and error process till you get the desired outcome for the specific cells you are trying to create the display rule for.
  5. Format: In this example I selected a light red background color.
  6. Placement: I selected the measure data item I am evaluating, Expenses. But notice that you have the other measure data items assigned to the Crosstab available.

17_Crosstab_Expression-1536x734.png

 In the screenshot below, I’ve used a red square to show how only the cells where the display rule evaluates to true and only at the intersection: Facility Region / Product Line / Date by Year / Date by Quarter are formatted with the red background.

 

18_Crosstab_Expression.png

 

You can also use Display Rules to assist when defining a scope for an aggregated measure. See my blog, SAS VA Report Example: Add a scope to an aggregated measure or YouTube, SAS Demo | Add Scope to an Aggregated Measure in SAS Visual Analytics for more information.

 

Pro Tip: Notice that unlike the List Table, the Crosstab Expression Display Rule only allows for you to select measure data items that are assigned a Role in the object to use in the Value comparison.

 

Table – Level Display Rule Considerations

 

One of the major benefits of Display Rules is that we can layer several rules on a single object. This can; however, lead to unexpected results. If you have multiple Display Rules for the same element, then the winning rule is the one at the top of the list.

 

Depending on the type of object, List Table or Crosstab, the type of Rule will determine how you can reorder and layer the rules. For all of the details, see SAS Documentation: Reorder Display Rules.

 

I’ve included an example for both the List Table and the Crosstab to demonstrate some of the layering results.

 

19_ListTable_Layering-1024x729.png

 

20_Crosstab_Layering.png

 

Summary

 

I hope these List Table and Crosstab examples have given you lots of ideas you can use in your VA Reports.

 

This is the second article in the series.

 

  • Report - Level
  • Table - Level (this article!)
  • Graph - Level
  • Gauge - Level

 

In the interim, here is a List Table Object using the Gauge (Icon) Display Rule summarizing the supported combinations of Display Rule type and Object level. This summary table will build out as we continue the series.

 

21_SupportedCombinationSummary.png

 

Here is a list of the supplemental enablement materials I mentioned in this article as well as other helpful resources:

 

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎07-19-2023 02:03 PM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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