04-01-2025
TeriPatsilaras
SAS Employee
Member since
06-16-2015
- 83 Posts
- 0 Likes Given
- 0 Solutions
- 6 Likes Received
About
Teri Patsilaras is a Senior Manager in the Global Enablement and Learning (GEL) Team within SAS R&D's Technology Transfer and Governance Division. Teri works to enable SAS technologists on the latest data visualization techniques and how to leverage SAS Visual Analytics to meet customer needs. She has extensive knowledge of report design methodologies and how to efficiently and effectively apply data visualization methods.
-
Latest posts by TeriPatsilaras
Subject Views Posted 539 03-26-2025 05:29 PM 1260 12-17-2024 04:28 PM 583 12-09-2024 03:19 PM 840 10-07-2024 01:31 PM 908 07-01-2024 04:27 PM 837 03-07-2024 12:39 PM 1039 11-02-2023 07:14 PM 792 10-26-2023 06:00 PM 967 09-25-2023 04:33 PM 1918 09-25-2023 04:22 PM -
Activity Feed for TeriPatsilaras
- Posted VA Report Example: Use a pop-up page to link to additional detail on SAS Communities Library. 03-26-2025 05:29 PM
- Posted Visual Analytics: Create a new filter from selected data on SAS Communities Library. 12-17-2024 04:28 PM
- Posted Re: VA Report Example: Use a Display Rule to highlight the maximum of an average measure on SAS Communities Library. 12-09-2024 03:19 PM
- Posted VA Report Example: Use the Text object for static and dynamic text on SAS Communities Library. 10-07-2024 01:31 PM
- Posted SAS Visual Analytics: Sum Missing Values on SAS Communities Library. 07-01-2024 04:27 PM
- Posted SAS Visual Analytics: A look at the new Expression Editor (Part 2) on SAS Communities Library. 03-07-2024 12:39 PM
- Posted SAS Visual Analytics: A look at the new Expression Editor (Part 1) on SAS Communities Library. 11-02-2023 07:14 PM
- Posted Re: SAS VA Bar Chart Rank (Banking Project) on SAS Visual Analytics. 10-26-2023 06:00 PM
- Got a Like for Re: Calculated Measure - Maximum of an Average measure. 09-27-2023 07:25 AM
- Posted Re: Calculated Measure - Maximum of an Average measure on SAS Visual Analytics. 09-25-2023 04:33 PM
- Posted VA Report Example: Use a Display Rule to highlight the maximum of an average measure on SAS Communities Library. 09-25-2023 04:22 PM
- Got a Like for Re: Color crosstable like excel. 09-06-2023 11:05 AM
- Posted Re: Color crosstable like excel on SAS Visual Analytics. 08-21-2023 03:50 PM
- Posted VA Report Example: Use Display Rules to get diagonal coloring on a Crosstab on SAS Communities Library. 08-21-2023 03:44 PM
- Posted SAS Visual Analytics Display Rules: Gauge – Level on SAS Communities Library. 07-19-2023 02:01 PM
- Posted SAS Visual Analytics Display Rules: Graph – Level on SAS Communities Library. 06-07-2023 08:12 PM
- Posted SAS Visual Analytics Display Rules: Table – Level on SAS Communities Library. 05-11-2023 05:32 PM
- Posted SAS Visual Analytics Display Rules: Report – Level on SAS Communities Library. 04-10-2023 04:58 PM
- Posted VA Report Example: Applying a Color-Mapped Display Rule for a Dual Axis Bar-Line Graph on SAS Communities Library. 02-22-2023 05:47 PM
- Posted Top 5 Things you need to know for using SAS Visual Analytics on SAS Communities Library. 01-23-2023 05:34 PM
-
My Liked Posts
Subject Likes Posted 1 09-25-2023 04:33 PM 1 08-21-2023 03:50 PM 1 02-16-2017 06:33 PM 1 02-15-2017 04:44 PM 1 03-08-2016 06:45 PM -
My Library Contributions
Subject Likes Author Latest Post 1 1 0 0 0
03-26-2025
05:29 PM
1 Like
A SAS Visual Analytics report requirement came in requesting a pop-up page to show additional detail including both category and measure data items. Let’s walk though one way to design a pop-up page to meet this requirement.
There are three types of pages in SAS Visual Analytics: basic, hidden, and pop-up. See the SAS Documentation Working with Pages for additional details. A pop-up page is a nonvisible page to report viewers that only appears when the viewer clicks on the source object. If the source object and target object use the same data source, then values are passed automatically and applied as a filter. This is extremely convenient! Otherwise, you will need to manually map data if you need values passed the objects. See the SAS Documentation Basic Tasks for Data in Reports for more information about mapping data.
Let’s take a look at the desired report behavior. The customer wants to select a Product Line in the bar chart and #1) filter the Dual axis bar-line chart and #2) open a pop-up page with the details of the selected Product Line, Total Year’s Average for both measures Product Cost of Sale and Product Sale.
Report requirements:
Select any image to see a larger version. Mobile users: To view the images, select the "Full" version at the bottom of the page.
Requirement #1: Filter the Dual axis bar-line chart:
Requirement #2: Open a pop-up page with the details of the selected Product Line, Total Year’s Average for both measures Product Cost of Sale and Product Sale:
Requirement #1 Filter the Dual axis bar-line chart
In order to configure the filter from the bar chart to the dual axis bar-line chart:
Select the bar chart, the source, to make it the active object.
Open the Actions pane.
Select the dual axis bar-line chart object, the target. Leave the default filter action selected.
Finished. Now when you select a value in the bar chart, the dual axis bar-line chart is automatically filtered. Toggle to View mode and test this configuration by clicking on a value in the bar chart.
Requirement #2: Open a pop-up page with the details of the selected values
In this pop-up page, we want to see the Product Line that was selected and then the yearly average for the two measures: Product Cost of Sale and Product Sale.
For beginners, when designing the pop-up page, it’s easiest to add a page prompt for the incoming values you expect from the source object, in this example, Product Line.
First start by configuring the page to be a pop-up page. Use the page’s toolbar menu and then select Page type and click Pop-up.
Next, design the pop-up page. Here are some tips that can help you when designing your pop-up page report:
Add the expected incoming values to a page prompt. In this example, I used a button bar control object and assigned the Product Line as the role. This will be deleted when you’re ready to test your pop-up page.
Consider resizing the window when designing your pop-up page to get an idea for how the report will appear when opened. Using the Options pane you can configure the size of your pop-up page when opened.
Use a blank text object for spacing. In my example, I wanted the key value object to be higher on the page next to the list table object so I added a text object under the key value object.
Once you have your pop-up page designed, configure the page link.
Selected the bar chart, the source object, to make it the active object.
Open the Actions pane.
Expand the Page Links group and select the target page, in this example I select the Details page.
Test the pop-up page. Toggle to View mode and double click on a value in the bar chart to open the pop-up page. Inspect the pop-up page. Are the objects returning the expected values? Do you like the design and layout? Continue the iterative process of tweaking the pop-up page layout until you are happy.
Once you are happy with the pop-up page, you can delete the page prompt. Test to be sure you are still getting the expected results.
Conclusion
Now you have seen how quick and easy it can be to design and configure a pop-up page for objects using the same data source. If your objects use different data sources, take a look at this article for Tips for working with multiple data sources in SAS Visual Analytics and how to configure the map data under the section Prompting with Multiple Data Sources. Once you add the data mapping, the same page link configuration steps can be taken.
Check out the below articles for additional SAS Visual Analytics examples:
Previous SAS Visual Analytics versions: Include Info Windows in your SAS Visual Analytics reports: Article | YouTube
SAS VA: Automatic Actions Part 1 – Easy exploration for multiple data sources: Article | YouTube
VA Report Example: Use Text Input for custom search: Article | YouTube
Use a List Control as a Visual Analytics Report or Page/Section Prompt
New control prompt placement option in SAS Visual Analytics
SAS VA: Use Custom Categories to create user-defined categories for dates, measures, or categories
SAS Visual Analytics 8.1: Configuring prompts with different source data: Article | YouTube
Tips for working with multiple data sources in SAS Visual Analytics: Article | YouTube
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
12-17-2024
04:28 PM
1 Like
Are you using Visual Analytics for data analysis or looking for anomalies? If so, then let me show you one of the easiest ways to get a subset of data fast! If not, this is still a nice feature to learn so that you can dive into your data to answer business questions.
New filter from selection
Most objects in Visual Analytics allow you to right-click on a data point and then use the menu to select New filter from selection and then you can choose to Include only selection or Exclude selection.
Select any image to see a larger version. Mobile users: To view the images, select the "Full" version at the bottom of the page.
This will automatically create and apply an object level filter. To undo the applied filter, use the Undo button at the top right.
And while this may be what you need, it is more likely you will want to include more than one data point. You can select multiple data points by holding the Shift key and either single clicking on data points or you can lasso data points. You can even combine methods by holding the Shift key then single click and lasso!
Next, right-click on one of the selected data points and proceed with selecting New filter from selection and then, in this example, click Include only selection.
The filter is automatically applied to the object. You can use the Maximize button to view the summary data that makes up the object. Use the Restore button to return to the default object view.
New filter then Duplicate as a different object type
Let’s combine a few more quick click features. This next example uses the dot plot object. In this example, I lasso some data points and choose an Include only selection
Then I duplicate the object as a list table and add an additional column for analysis. Notice that when I duplicate the object, the same filter is applied to the objects.
Now we can analyze the Product Makes with the highest Order Totals and by adding in the data item Vendor Type we can see which type is contributing to the most orders. This can be helpful to identify trends and we can make decisions to continue to supply certain vendor types or make changes.
Bar chart
Here’s an example using a bar chart object. In this case, I selected all of the Product Makes greater than one million dollars and Exclude selection.
Now I can investigate the under performing Product Makes. I right-click on the filtered bar chart and select Duplicate as then click Treemap.
Then, from the Data Roles pane I add the data item Order Marketing Cost (Avg) to the Color role. This is allowing me to explore the under performing Product Makes and see where we are spending, on average, the highest marketing costs.
List table
Similarly, you can take these same steps using the list table object. In this example, the only change is in order to multi-select non-consecutive rows, use the Ctrl button instead of Shift.
Here I selected the Product Line with the highest and lowest Order Totals. In a duplicated list table I added the Order Marketing Cost (Avg) data item and it’s easy to see the difference. If the same amount of marketing cost is applied to all Product Lines equally, could there be an increase in Order Totals?
Conclusion
Not all objects will have the option to create a New filter from selection but most will have this feature and we can see how fast this allows us to create a filter, duplicate the object with the same filter and then add additional data items or change the object type for further analysis.
I don’t cover it here, but you can always copy a filter or make it a common filter to easily reuse with the same data source on other objects in the report! Check out the Using common filters in SAS Visual Analytics article or YouTube.
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
12-09-2024
03:19 PM
Hi,
Based on the name of your calculation, since you have the word MAX in there - I thought you were trying to get the final formula. Here's what it would look like using the new UI.
Let me know if you're still having trouble.
Thank you,
Teri
... View more
10-07-2024
01:31 PM
The Text object is one of the most versatile objects in SAS Visual Analytics. It can be used to display both static and dynamic text. Some static text use cases include report instructions, annotations such as report author, update frequency, table source name, and explanatory text.
To demonstrate some of the dynamic text use cases, I built a sample report where I use the Text object to incorporate the following elements:
Report Title
Interactive Filters
Parameters
Measures
Display Rules
Table Modified Time
Select any image to see a larger version. Mobile users: To view the images, select the "Full" version at the bottom of the page.
Like other objects in SAS Visual Analytics, if you want the object to return a data item value, it must be assigned to a Role in the object. Once Roles are assigned, then the Text object will use that data source’s data items only and you cannot have a different data source’s data items contribute to the Text object.
The exception is parameters. For those familiar with SAS Visual Analytics, recall that parameters are not tied to a single data source but are actually part of the report, and available across the report’s pages.
Let’s take a look at how I configured each of these objects. The dynamic text elements are in the blue bold font in this example report.
Report Title, Parameter, and Interactive Filters
Let’s take a look at how we configured the Text object that is surfacing the report title, a parameter and the interactive filters.
Parameter Link
First, we need to store the value we want in the parameter. In this example report, we will use the Transaction Year drop-down that is a report prompt and store the selected value in the parameter named Transaction Year Parameter. With the drop-down control object selected, use the Actions pane to create the parameter link.
Interactive Filters
In order to be able to surface the Interactive Filters dynamic text, the report page must be configured to use Automatic One-way filters. By default, the Display filter breadcrumb is selected but since I want to include the interactive filters in my Text object and I don’t want it display twice, I will deselect it for this example.
To configure, make sure you have the page level selected, then in the Actions pane, select Automatic actions on objects.
Note: If you were to select Two-way filters then you cannot deselect the Display filter breadcrumb option and the breadcrumb option is not available for Linked Selection.
Text Object Configuration
Now let’s configure the top Text object.
When you add a new Text object to the report canvas, the first thing is to assign any measure or parameter values. It is easier to add static text around the dynamic elements. So, using the Roles pane, select the Transaction Year Parameter.
Now we can open the Text object for the rest of the configuration. Double click inside the object or you can use the toolbar menu and select Edit.
Next, place your cursor on a new line and use the Data drop-down menu and select Interactive Filters.
Now you can go in and add in the static text around the dynamic elements. You can adjust the alignment, font size, style, and color. Notice in my example, I made all of the dynamic elements bold blue so you can easily spot them.
Once you are happy with your edits, click OK to close the editor. When you click close and look over at the Roles pane, you may be surprised to see that the measure Frequency is now showing as assigned to the measure role.
Don’t panic, this happened automatically when you added the Interactive Filters from the Data drop-down. Recall that parameters are a report level data item but all other data items, categories and measures, are tied to a single data source. Therefore, since we will be displaying interactive filters, this Text object needs to know what data source it will be tracking and by adding Frequency, which is not shown, it is now tied to the data source.
Parameter, Measures and Display Rules
Let’s take a look at the second Text object in the report which surfaces a parameter, three different measures, one of which has Display Rules defined.
Measures
The only thing you need to do is make sure you have the correct formats and aggregation types set for your desired measures. We will be using the report filter for Year and the Automatic One-way filters on the page to do the filtering of our measures for us.
Notice that the Text object can return both the standard measure and aggregated measures.
Text Object Configuration
Like before, it is easiest to first add the dynamic elements then go in and add the static text around it. Add the new Text object and then assign the Roles in the order we want. You can always move them around but it’s easier if you know the order. The numbers next to each data item represents the order in which I added them to the Text object.
Next, edit the Text object by either double clicking on the object or using the toolbar menu. Add in the static text and then format the position, font style and color as you like.
Display Rules
In this report example, I create a display rule for the Vendor Satisfaction measure with the following criteria:
If less than 30%, color the measure red.
If between inclusive 30% and 60%, color the measure yellow.
If greater than 60%, color the measure green.
Use the Display Rules pane then select New rule and click Vendor Satisfaction.
Then define the first display rule. You will need to create three separate rules to incorporate our desired behavior.
Repeat creating a new rule for each display rule criteria.
For more information about Display Rules refer to this article: SAS Visual Analytics Display Rules: Graph – Level. The Text object would behave similarly to the Graph-Level Expression based Display Rule.
Table Modified Time
For the last Text object in the report, let’s look at how we can configure it to display the Table Modified Time.
Text Object Configuration
Open the Text object and then use the Data drop-down and select Table Modified Time. This will add the dynamic text to the editor.
Then enter the static text around the dynamic element and format the text as desired.
Conclusion
Now you know how to add several dynamic elements to the Text object. You did not miss the coverage for adding category data items to a Text object. Since the Text object aggregates the data based on any prompts or filters, we do not have a way yet to return an aggregation of category data values. There is one exception, you can use a character parameter that has been linked to a control object.
Therefore, the dynamic elements that the Text object can support are:
Report Title
Interactive Filters
Parameters
Measures
Display Rules
Table Modified Time
If you are using an older version of SAS Visual Analytics, you can refer to this article: Using Dynamic Text in a VA 7.4 or 8.2 Report.
Additional articles using SAS Visual Analytics Automatic Actions:
SAS VA: Automatic Actions Part 1 – Easy exploration for multiple data sources
SAS VA: Automatic Actions Part 2 – Dive into multidimensional or hierarchical data easily
SAS VA: Automatic Actions Part 3 – Find related data fast
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
07-01-2024
04:27 PM
At first glance, you might be wondering if you read this correctly, because any good SAS coder worth their salt, knows that the SUM function handles missing values, well it ignores them when using the SUM function and sums the nonmissing values. But what about when you use addition? SAS Visual Analytics actually has similar behavior to SAS code for both sum and addition but one is applied automatically and the other is manual. Let’s look at how you can get the values you want without having to go back to the raw data.
SAS Code
Here is a SAS code example using the SUM Function and basic addition.
To get the total expenses, we are summing or adding the four underlying expenses: capital, material, operational, and staffing. Notice that for the two Product Lines, Promotional and Stuffed Animal, there are missing capital expenses.
Zeros and missings are not the same and should not be interchanged in the raw data. Please take a look at Charu Shankar’s blog: Is something missing or is it a ZERO? As you’ll read, the most impacted computation is when you average the data.
When you sum or add the data, SAS gives you two types of behavior. The SUM Function will return the result while the addition expression will return missing if any of the operands have a missing value.
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 Visual Analytics
Let’s take a look at what happens in SAS Visual Analytics. Ultimately, the rule of thumb is that any automatically totaled data performed by the object, uses a SUM Function-like expression. It isn’t the exact same, since SAS Visual Analytics is using the CAS (Cloud Analytic Services) engine and uses CAS actions, but the result is the same.
Here is the sum of Expenses (capital) using the automatic Option for the List table and Crosstab objects. The aggregation used in the Bar chart defaults to sum. Each of these use the CAS summary action. The automatic totaling we are seeing here is using the aggregation type defined for the measure data item Expenses (capital) which is SUM.
This is not the same as the expression where we are summing all of the different expenses like above, unfortunately, this type of expression is not available in SAS Visual Analytics.
Now let’s take a look at the addition expression, like the code line highlighted below. This is an expression we can reproduce in SAS Visual Analytics and we get the same results as we would when coding.
In Visual Analytics, here is the new calculated data item expression.
And here are the results in a List table compared to the SAS Studio code results. We can see we get the same results.
Now let’s look how we can reproduce the Sum column in SAS Visual Analytics.
We are not going to change the underlying raw data where if the value is missing, change it to a zero. But we can use the IF… ELSE operator and the Missing function to check to see if the value is missing, if it is then use a zero in the addition expression, else use the actual value.
Now we get the sum of missings just like we did with the Sum function in SAS code but we are really using the addition operator.
Now you can preserve the integrity of your source data’s missing values and still get the sum of values in your report.
Learn More
New Expression Editor:
SAS Visual Analytics: A look at the new Expression Editor (Part 1)
SAS Visual Analytics: A look at the new Expression Editor (Part 2)
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
03-07-2024
12:39 PM
In Part 1 of this series, I focused on the point-and-click instructions for building expressions. In Part 2, this article, I will demonstrate the coding features.
The new Expression Editor was first introduced in Stable 2023.06 (June 2023) and included in the LTS 2023.10 (November 2023) release. There are some noticeable changes to previous versions and I wanted to go through some tips and tricks for using the new editor.
I know I used the quote from Paul Cezanne, "It’s so fine and yet so terrible to stand in front of a blank canvas" to relate to those who dislike the daunting task of putting something into a blank window. But there are those that enjoy the blank slate and jump right in. I like the Vincent van Gogh quote, "Just slap anything on when you see a blank canvas staring you in the face like some imbecile." But also Stephen Sondheim’s, "White. A blank page or canvas. So many possibilities." from the musical Sunday in the Park with George.
This is what the new Expression Editor can offer: the flexibility to code using SAS syntax, structure and document using your preferred style. Here are some of the features available in the new Expression Editor:
suggestion lists for data items, operators, functions
inline help for operators and functions
add comments
reformat your code (Available Stable 2024.01 (January 2024))
Let’s take a look at the same expressions that I showed you how to build using the point and click options in Part 1 of this series, but this time, using code.
Subtraction Expression
To build the subtraction expression using the point and click method, it took roughly eight steps. Let’s take a look if we just start typing. (Hint: it’s less than eight and I was over generous with the numbering.) Here the expression we will build. The text highlighted in yellow is what I manually typed.
First, I added a comment line and then started typing the name of the data item. As soon as I started typing the name of the data item, you can see the drop-down list of suggestions. I see the data item I want at the bottom, so I used my mouse to click on Unit Yield (target). You could also have arrowed down and press enter to have the data item added to the expression.
Next, I typed the subtraction operator and I started typing the name of the next data item I wanted to add to the expression. You can either use your mouse to click on the suggested data item or your can use your arrows and press enter.
Done in four steps! Coding a simple expression is very fast and straight forward if you know the name of your data items!
IF... Else WITH In Condition Expression
This next expression, If... Else, is extremely customizable and one of the few with no auto complete available. The SAS syntax, which you can see below, is straight forward and similar to other programming languages; therefore, quite easy to type freehand.
And one of the extremely nice things about this expression editor, is that even if you start typing you can always use the point-and-click functionality. There is no suggested list for actual data values, so you can use the Edit functionality that will open the expression builder to see a list of data values so you don’t have to worry about getting the case correct when typing.
First, I type If and parenthesis then the data item name Product. I select the data item Product from the suggested list. Remember, the text highlighted in yellow is what I manually typed.
Next, I start typing for the function In and select it from the suggested list.
Finally, I type the rest of the expression. There is no suggested list of data item values when typing like there is with the point-and-click wizard.
And available starting in Stable 2024.01 (January 2024) release is the ability to reformat your code for greater readability. You can use the right-click menu or the key combination Shift + Alt + F.
Typing the If... Else expression took four steps as opposed to the seven steps when using the point-and-click method. Here’s a demo of coding the If... Else expression.
Ratio with Sum numerator and AggregateTable denominator Expression
Like in the previous post, this last expression I want to build comes from the article: SAS Visual Analytics Report Example: Percent of Total – For All, For Rows, and For Columns.
The need to find a column’s percent of total has been popular recently, so let’s take a look how we would build this using the new expression editor. Feel free to read the entire article, but here are the expressions we will need to build using the new expression editor.
And here is my screenshot of the solution using the previous expression editor.
Here is a screenshot of the solution using the new expression editor.
Since this one is straight typing and using the suggested auto complete, here’s the demonstration.
Conclusion
I hope that you now feel comfortable to dive right into the new Expression Editor and start typing. Here’s a summary of some of the features that will make building expression using code easier:
suggestion lists for data items, operators, functions
inline help for operators and functions
add comments
reformat your code (Available Stable 2024.01 (January 2024))
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
11-02-2023
07:14 PM
The new Expression Editor was first introduced in Stable 2023.06 (June 2023) and will be made available in the LTS 2023.10 (November 2023) release. There are some noticeable changes and I wanted to point out how to use some of the new features.
The quote from Paul Cezanne, "It's so fine and yet so terrible to stand in front of a blank canvas" can resonate when you first look at the new expression editor. This can be especially true if you don’t want to start typing syntax! But don’t worry, as soon as you start to click in the editor, you’ll find your fears put to ease.
In Part 1 of this series, I will focus only on point-and-click instructions for building expressions. Part 2 of this series will demonstrate the coding features.
Select any image to see a larger version. Mobile users: If you do not see this image, scroll to the bottom of the page and select the "Full" version of this post.
Subtraction Expression
Let’s first look at building a simple expression. The only thing you’ll need to do is point, click, and place your cursor in the second argument position. In less than ten steps, you can build this subtraction expression.
The key take aways from this example are:
Single click to add operators, functions, or data items to the expression editor.
Place your cursor at the position you want to add a new operator, function, or data item.
Type in the filter at the top to narrow down selections.
IF... ELSE with In Condition Expression
This is a commonly used expression in most reports I build, usually to build a flag indicator to define Display Rules. Let’s take a look at how to build this using the new expression editor.
The key take aways from this example are:
Some functions have an expression builder wizard.
To get back to the expression builder wizard, right-click anywhere inside the expression then select Edit.
Ratio with Sum numerator and AggregateTable denominator Expression
This last expression I want to build comes from the article: SAS Visual Analytics Report Example: Percent of Total – For All, For Rows, and For Columns.
The need to find a column’s percent of total has been popular recently, so let’s take a look how we would build this using the new expression editor. Feel free to read the entire article, but here are the expressions we will need to build using the new expression editor.
And here is my screenshot of the solution using the previous expression editor.
Here is a screenshot of the solution using the new expression editor.
Here’s the demonstration:
The key take away from this example is:
You can build out your expression structure then go back and assign data roles, aggregations, etc.
Conclusion
I hope that you are now less weary about using the new Expression Editor. There are lots of new features I haven’t covered yet, but I will cover the coding using inline help and code completion for the Part 2 article.
When using point-and-click for the expression editor, here’s a summary of the things to keep in mind:
Single click to add operators, functions, or data items to the expression editor.
Place your cursor at the position you want to add a new operator, function, or data item.
Type in the filter at the top to narrow down selections.
Some functions have an expression builder wizard.
To get back to the expression builder wizard, right-click anywhere inside the expression then select Edit.
You can build out your expression structure then go back and assign data roles, aggregations, etc.
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
10-26-2023
06:00 PM
Hi @Suprodip98
In order to use a date data item in the Rank object, you'll need to use the TreatAs operator to convert the SAS date into a number.
I have a blog using an older version of SAS Visual Analytics here: Use Rank in SAS Visual Analytics to display the last date, month or rolling window
Let me know if you have additional questions.
Thank you,
Teri
... View more
09-25-2023
04:33 PM
1 Like
Hi @Pandomania ,
I wrote an article outlining how I used the AggregateCells operator with Display Rules to get this solution:
See the steps here: VA Report Example: Use a Display Rule to highlight the maximum of an average measure
I hope this helps!
Thank you,
Teri
... View more
09-25-2023
04:22 PM
3 Likes
A SAS Visual Analytics report requirement came in requesting to dynamically highlight the maximum of an average measure. The added level of complexity to this requirement is that it is to also support a hierarchy.
Whenever you see the requirement to dynamically highlight this translates into Display Rules in SAS Visual Analytics. Check out my Display Rule Series here:
Report - Level
Table – Level
Graph – Level
Gauge – Level
Let’s look at the final solution. In this first click path through the hierarchy: Oceania – Australia, we can see how the first bar in the Bar Chart Object is being dynamically highlighted.
In this second click path through the hierarchy: South America – Argentina you can see again how the first bar in the Bar Chart Object is being dynamically highlighted.
Report Requirement
Desire to highlight the maximum value on a Bar Chart for the measure Average Gross Margin which is a calculation of Product Sale – Product Cost of Sale aggregated as an average. The category is a geographic hierarchy: Continent – Country – Region – City.
Solution Part 1: Average Gross Margin
Disclaimer: my data is not exactly representative of the request, so I had to work with the columns available to me.
Since this is a straightforward expression, we can use the power of SAS Visual Analytics’ default aggregation to do a lot of the work. However; you can use a more complex expression, so I will show both the simple and complex, in case you need to substitute an advanced expression to meet your needs.
Simple Expression: Create a Calculated Data Item and use the default Average Aggregation Notice in this simple expression, I create a Calculated Data Item. I then assign the Average Aggregation behavior from the Data properties pane.
Complex Expression: Create an Aggregated Measure In the complex expression, I create an Aggregated Measure. In this expression, I define the average aggregation but using a ratio operator. I wanted to show you can use this solution for more complex expression if needed. You do not have to create the aggregated measure and you can instead use the default aggregation if your business needs suit.
If you need additional information about a Calculated Data Item versus an Aggregated Measure, you can reference my Article or YouTube.
Here I wanted to show that we get the same results across the different levels of the hierarchy:
Solution Part 2: Find the Maximum Average Gross Margin
In order to find the maximum of a group of cells, I use the AggregateCells Aggregated (tabular) Operator. See the SAS Visual Analytics Documentation: Reference: Operators and Functions for Data Expressions for more detail.
Notice in the below screenshots, I will set the aggregation type to _Max_ and I will set the start-index and the end-index to encompass all of the cells in the visualization object.
I include both screenshots using the simple and complex expressions as defined above.
AggregateCells Expression: Using the Simple Expression Notice here, I simply plug in the Calculated Data Item that I created earlier.
AggregateCells Expression: Using the Complex Expression Notice in this example, I do not plug in the previously created Aggregated Measure. You can, but I wanted to illustrate that you can put an aggregated measure expression inside the AggregateCells operator.
Again, here is a screenshot looking at our results when added to the Crosstab object. We get the same, as expected.
Solution Part 3: Assign Data Roles and Define Display Rule
Before I add the Bar Chart Object to the report, I will define the Display Rule for the Crosstab objects. This solution works for any visualization object, which is the true power behind SAS Visual Analytics. Some of the Objects will allow for Hidden or Data Tip Roles which allow you to hide the Max Gross Margin data item but other Objects will require both data items to be assigned a Role in order to define a Display Rule.
Here is the Display Rule definition: If the Average Gross Margin = Max Gross Margin then highlight graph green.
Since I have two sets of expressions for simple and complex, I duplicated the Display Rule. Notice that for the bottom Crosstab object there are two rows highlighted. That is because for each level in the hierarchy it will highlight the level’s maximum!
Now we can add the Bar Chart Object to the report, assign Data Roles and define the Display Rule. The Bar Chart is one of the Objects that allows you to use any measure combination in the Display Rule definition without requiring it to be assigned an explicit Role.
And even snazzier, since the requirement came in saying the hierarchy was a geographic hierarchy, you can even see this on a Geo Map Object. In order to be able to define the Display Rule for this Object, you can add the Max Gross Margin to the Data tip value Role.
Conclusion
I have now shown you how you can use the AggregateCells Operator to get the maximum of an average measure. You can then use Display Rules to conditionally highlight the maximum value using a variety of visualization objects.
If you need additional information on Display Rules or would like step-by-step instructions, please refer to my series here:
Report - Level
Table – Level
Graph – Level
Gauge – Level
If you need additional information about a Calculated Data Item versus an Aggregated Measure, you can reference my Article or YouTube.
And here is a list of additional Visual Analytics report examples:
VA Report Example: Use Display Rules to get diagonal coloring on a Crosstab
VA Report Example: Applying a Color-Mapped Display Rule for a Dual Axis Bar-Line Graph
VA Report Example: Moving Average
VA Report Example: Percent of Total – For All, For Rows, and For Columns
VA Report Example: Moving 30 Day Rolling Sum
VA Report Example: Number of Days Profitable for the last 30 days
VA Report Example: Current Month vs Previous Month
VA Report Example: Month Average versus Total Average
VA Report Example: Ways to use the Cumulative Period operator
VA Report Example: Relative Period Report in SAS Visual Analytics
VA Report Example: Distinct Count If – Run multiple queries at once
VA Report Example: Add a scope to an aggregated measure: Article | YouTube
... View more
- Find more articles tagged with:
- GEL
Labels:
08-21-2023
03:50 PM
1 Like
Hi Luca,
I wrote a blog to use a Crosstab Object with Display Rules to get this solution:
See the steps here: VA Report Example: Use Display Rules to get diagonal coloring on a Crosstab
I hope this helps! Thank you,
Teri
... View more
08-21-2023
03:44 PM
1 Like
I saw a SAS Visual Analytics report requirement request a diagonal color pattern be applied on a Crosstab Object. And since I just finished my series about Display Rules, I thought this would be a fun exercise to walk through.
Display Rule Series:
Report - Level
Table – Level
Graph – Level
Gauge – Level
Here was the original request:
Select any image to see a larger version. Mobile users: To view the images, select the "Full" version at the bottom of the page.
And here is the solution using SAS Visual Analytics:
Data Structure
I wanted to use the Crosstab Object in SAS Visual Analytics for two reasons:
I didn’t want to use a List Table Object because I would have had to add 25 individual data items to the Data Roles.
I wanted to find a mathematical pattern or equation that I could use to assign the Display Rules and I didn’t want to define four Display Rules for each of the 24 individual data items.
Therefore, I transposed data structure similar to this. Notice that when I import this Excel file into SAS Viya, the Date-1 will come in as a measure data item and the Date will come in as a category data item.
In order for me to assign both Date-1 (measure) and Date (category) to the Crosstab Object they must both be category data items. In SAS Visual Analytics, it is very easy to do this. All you need to do is:
Duplicate the Date-1 data item.
Change the Classification from Measure to Category.
Change the name to make it easier for you to identify.
This allows me to define the Crosstab Object Data Roles like this:
Display Rule Solution
I got lucky with the data structure that was in the original request. We can see in the Row and Column Data Roles that the values are from 0 to 23 or a character prefix in front of 0 to 23.
This gave me the idea much like the elementary math story of Gauss, where he was given the task to add up the numbers between 1 and 100 inclusive and instead discovered a formula to solve the problem.
Now, in no way am I comparing my abilities for mathematical problem solving to Gauss, but I did see a pattern in the coloring when I used the expression of taking the absolute value of the difference in the Row and Column values.
One of the tricks to get this to work is that I need both data items to be measures. Funny, right! Because I just made sure that both data items were categories. So now we need Date (category) to be a measure data item. To do this, we have a few more steps than simply duplicating and changing the classification type.
Here is the expression to use. We will use the Parse Operator to assign a numeric format but we first need to get only the numbers after the prefix "t1_". I will use the Substring Operator to start at the fourth position and read two digits.
Now I can build the expression for the Color Expression where I take the absolute value of the difference between the Row and Column values.
In order to define a Display Rule for our Color Expression data item, we will need to add it to the Crosstab Object. I know this isn’t ideal, but the Crosstab Object does not support the Hidden Data Role. Don't worry, I’ll show you a few tricks we can apply to polish off the solution. Add Color Expression to the Crosstab.
Now here is the pattern I found to use in building the Display Rules. If you need additional guidance on the steps then please take a look at my blog: SAS Visual Analytics Display Rules: Table – Level.
At this point, you’ll have something that looks like this:
Finishing Touches
Let’s make the a few changes so that this can get closer to the initial customer requirement.
Rename Color Expression to “.”
Use the properties drop-down to change the name of the Color Expression data item to be a single small character. In the end I chose to use the period, but a lower case L could also work. Don’t worry, SAS Visual Analytics automatically handles any expressions or Display Rule references to this name and it’s updated automatically for you!
Rename Date-1 (Cat) to Date-1
Again, don’t worry that it looks like we have two data items with the same name Date-1. SAS Visual Analytics will add an internal reference name so that it can tell the difference between the two.
Style the Crosstab Cells
Last, we need to color all of the cells in the Crosstab to be pink using the Background color and I deselected the Alternating background color.
Now we have our finished visualization:
Conclusion
I have shown how we can use the Crosstab Object and Display Rules to get a diagonal coloring on the visualization. There are a few workarounds to set up the report but, in the end, this is a great way to programmatically reproduce the initial requirement while being able to easily schedule data refreshes.
See the below for additional Visual Analytics report examples:
VA Report Example: Applying a Color-Mapped Display Rule for a Dual Axis Bar-Line Graph
VA Report Example: Moving Average
VA Report Example: Percent of Total – For All, For Rows, and For Columns
VA Report Example: Moving 30 Day Rolling Sum
VA Report Example: Number of Days Profitable for the last 30 days
VA Report Example: Current Month vs Previous Month
VA Report Example: Month Average versus Total Average
VA Report Example: Ways to use the Cumulative Period operator
VA Report Example: Relative Period Report in SAS Visual Analytics
VA Report Example: Distinct Count If – Run multiple queries at once
VA Report Example: Add a scope to an aggregated measure: Article | YouTube
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
07-19-2023
02:01 PM
3 Likes
This is the fourth and final post in a series about the available Display Rules in SAS Visual Analytics.
Report - Level
Table – Level
Graph – Level
Gauge – Level (this article!)
Recall from the previous articles, 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.
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.
Gauge – Level
In this article, I will be focusing on the Gauge - Level Display Rules that apply to the Gauge Objects. We saw in the Table – Level Display Rule article that the List Table Object supports a gauge display rule however, it only supports a subset of gauges.
The recommendations in this article will span more than just the display rule since the dedicated gauge object itself has several aspects to consider when using in your report.
The Gauge Object, has six Shape options and six Style options which includes a Customizable Style which gives over thirty-six possible combinations.
Despite the many ways you can style a Gauge Object, the fundamental steps to define the Gauge – Level Display Rule are the same. I like to think of the steps as an equation.
Add the Gauge object from the Object pane to the report page.
Assign Data Roles.
A default interval expression Display Rule will be defined based on the Data Roles. Customize as necessary.
Success – you have your gauge.
Now let’s dive into the different options, combinations, and customizations for the Gauge Object and Gauge – Level Display Rules.
Gauge Object
To satisfy the curious, I put together a sample of the available Shape and Style gauge combinations. I kept the default three equal interval expression Display Rule and the default red, yellow, green coloring so that you can easily see how the same Display Rule definition looks across the different gauge combinations.
Gauge Objects became popular with the rise of the dashboard style of reporting in the 1990’s when business needs required a quick way to assess their key performance indicators (KPIs). These gauge objects are similar to what you would see on a dashboard for a plane, automobile, or manufacturing machines for monitoring fuel, pressure, temperature, etc.
At a quick glance, which style and shape do you prefer? I tend to prefer the thermometer styles since it only shows the interval color that has been met and displays the interval ranges.
Data Roles
Now that we have examples of the types of gauges we can include in our report, let’s look at the data role assignments and best practice recommendations.
Notice in the Roles pane that there is only one required data role and that is for the Measure assignment. This tells us that the gauge will aggregate the measure data item for the data source and apply any filters defined.
The Target Role is a measure field and it should match the scale of the Measure Role as the measure represents the magnitude of how close it is to the target. Another optional Role is the Group role. This will act as the by group and the Measure (and Target if assigned) will be aggregated by the category data item assigned to the Group Role.
One best practice recommendation to consider, if you are using the Group assignment or using multiple gauges on your report, is the scale. The scale is essentially the range of numbers that help to measure or quantify the target. If you are in a business where your Group values have consistent targets or performance, then you are lucky and this may not apply to you. Otherwise, consider using a percentage-based measure scale so that even if the magnitude of the scale is different, you can easily compare these values.
In this first example, if you have Unit Yield (actual) and Unit Yield (target) values, you could use the Unit Yield (rate) = Unit Yield (actual) / Unit Yield (target). This is especially helpful, in this case, when the Product Lines have widely different unit yield actuals and targets.
In this second example, using a percentage-based Measure allows you to easily duplicate the gauge and change the Group Role as you explore your data.
In this third example, I used a cumulative percent of total across the months to show the progress to the Year’s Order Total. I can now easily use the Year drop-down prompt to explore the data without having to adjust the scale.
Gauge – Level Display Rule Now we need to explore our third operand in our equation, the Display Rule. When you use a percentage-based Measure Role assignment there is no requirement to have the Target Role, and the intervals can be defined between 0 and 1.
Notice that in the Display Rule overflow menu there is an option to Recalculate.... This brings up a dialogue window that helps you to easily define equal intervals between lower and upper bounds. The default lower and upper bounds are prepopulated with values which are queried from the data source based on the Role assignments.
You can then manually change any of the interval bounds as you like. You can also use the color chip to select the desired color you want associated with each interval.
In the case where you are using actual values, and not percentages, and using both a Measure and Target Role assignments then you may run into the informational warning that The gauge contains an out of bounds target which is not shown. This is because the default lower and upper bounds for the interval display rule is queried from the Measure data item. You can use the Recalculate window to make the adjustments to either the lower or upper bound as needed.
Notice that the intervals have to be manually entered and cannot yet be dynamically driven. This is why it is recommended to, if your data allows, use a percentage-based measure and interval definition.
Another recommendation is to be sure the lower bound for any bar-based gauge starts at zero. This is the industry wide recommendation for any bar chart or bar gauge to start at zero. The other styles, such as the arc or dial variations, can have a lower bound not start at zero but use caution as most real-world applications of these gauges have conditioned us to use zero as a starting point.
Summary
Here are the key points for using the Gauge – Level Display Rules which encompasses more than just the display rule itself since it uses its own Gauge Object.
Use a percentage-based measure so that it can easily adjust for additional data and across different by groups. This allows for an easy Gauge – Level Display Rule interval definition to be between 0 and 1.
For any bar style gauge objects, be sure to start the lower bound at zero. Also, consider using zero as the lower bound, unless your measure includes negative values, as we have been condition by real-world applications to assume the starting point is zero.
This now concludes the series for using Display Rules in SAS Visual Analytics.
Report - Level
Table – Level
Graph – Level
Gauge – Level (this article!)
Here is a list of the supplemental enablement materials I mentioned in this article as well as other helpful resources:
Get to know the List Table
Creating Hierarchies to use in SAS Visual Analytics Reports
SAS Visual Analytics Cell Graphs to enhance List Tables and Crosstabs: Article | YouTube
SAS VA Report Example: Add a scope to an aggregated measure: Article | YouTube
Use Report Themes to quickly change your data color palette
SAS VA: Use Custom Categories to create user-defined categories for dates, measures, or categories: Article | YouTube
SAS VA: Automatic Actions Part 1 – Easy exploration for multiple data sources: Article | YouTube
SAS Visual Analytics 8.1: Configuring prompts with different source data: Article | YouTube
Tips for working with multiple data sources in SAS Visual Analytics: Article | YouTube
SAS Visual Analytics Report Examples using Container Objects: Article | YouTube
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
06-07-2023
08:12 PM
1 Like
This is the third post in a series about the available Display Rules in SAS Visual Analytics.
Report - Level
Table – Level
Graph – Level (this article!)
Gauge - Level
Recall from the previous articles, 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.
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.
Graph – Level
This article builds on the concepts and steps presented in the previous articles. I will not have all of the click paths enumerated in this article, but I will focus on the features, style combinations, options and considerations. If you need those steps, please refer to the Table – Level article.
I will cover the Graph – Level Display Rules. In general, most graph objects support two types of display rules:
Color-mapped Value
Expression
However, bear in mind, there are thirty different graph objects and ten different geo objects in SAS Visual Analytics and each object can have its own nuances. I have highlighted the Graph – Level in the below summary table, let’s take a look at a some examples.
Graph – Level: Color-mapped Value Display Rule
For the below graph objects, I defined each display rule for each individual graph. Since I already covered Report – Level Display Rules in my previous article, I wanted to show how the different graph elements displayed the Color-mapped Value Display Rule. One of the major differences in a Report – Level and Graph – Level Color-mapped Value Display Rule is that at the Report – Level you can define it for any category across any data source in the report. This is not the case for a Graph – Level Color-mapped Display Rule where once you select a graph object, the display rule is tied to the data source and you must select either a single category data item or any category data item for that one data source for the rule definition.
I split this report page into two columns. On the left, I defined a Color-mapped Value Display Rule for the category data item Facility Region and on the right column for the category data item Product Line.
Left Column: Facility Region Color-mapped Value Display Rule You can see down the left column there is a Bar chart, Bubble plot, Box plot, and Word cloud. Right now, you are seeing the Display Rule in effect for all of these graph objects, but that is because I did not define a Color Data Role for either the Bubble plot or the Word cloud. If I had, then the Color Data Role takes precedence over the Graph – Level Display Rule.
Right Column: Product Line Color-mapped Value Display Rule On the right column, I have added a Pie chart, Treemap, and a Key value latticed by Product Line. Again, you are seeing the Display Rule in effect for these graph objects, but like the Word cloud above, if I assign a Color Data Role for the Treemap then that role assignment takes precedence over the Graph – Level Display Rule.
You can also define Color-mapped Value Display Rules for Geo map objects. SAS Visual Analytics has ten different geo maps and not all display rule options are available for teach type, similar to the standard graph objects like above. Be sure to refer to SAS Documentation: Working with Display Rules for additional details.
The Geo bubble map, so long as you do not assign a Color Data Role, will evaluate the defined Color-mapped Value Display Rules. Here are two examples. Notice that for the lower map I have selected to plot the Facility State Geo data item but I am using the display rule to color the bubbles according to the values in Facility Region Geo. Also notice that I had to use the Any Category for that display rule.
The upper map is straight forward, where I use Facility Region Geo in both the Geography Data Role and in the display rule definition.
This next feature of display rules for Geo map objects is very customizable. For only the Geo coordinate and Geo network map objects you can specify an Icon in place of the standard geo marker. In the below example, I used an icon that is in the shape of a building, but there are many out-of-the-box icons to select from. You can even upload your own custom icon but custom icons are static images and do not respond to the selected color as the standard icons do. I could have selected a different icon for each value in my display rule, but for this example, I kept them all the same.
Next, I wanted to give an example using our Geo pie map object. This object was released with the LTS 2022.1 (May 2022) release and allows you to define a pie chart object to replace the geo marker. As you can see in this example, I defined my display rule to use the Product Line category data item.
Graph – Level: Expression Display Rule
Recall that when you define an Expression Display Rule you must select a measure data item and build a Boolean expression that when it evaluates to true, the rule is applied (if applicable) and when false, no rule is applied. Recall that we also learned in the Table – Level Display Rules article that we can layer and order Expression Display Rules. Keep in mind that the winning rule is the one at the top of the list, or the rule that is applied last.
One of the fantastic features about using an Expression Display Rule is that typically all the measures in the data source are available to use in the expression definition even if that measure is not assigned to a Data Role in that object.
In this below example, I am showing one of the Graph – Level Expression Display Rule options to select a Style Area: Graph or Background. On the left, I have selected the display rules to be applied to the Graph element. Where on the right, I defined the display rules to be applied to the Background element. We can see how the Graph affects the actual bar colors and the Background affects the area behind the bars.
This is one of those Expression Display Rule Options that is available for a subset of the graph objects. Generally, most graph objects only support the Style Area: Graph option since the background of some graph objects do not fall into such a defined range.
In this next example, I use a Line chart graph object to demonstrate some of the Style Area: Graph or Background features. Notice that for each Line chart I have the Options: Markers turned on. Those are the filled circles at all of the data points. If you want to have the Line chart’s Expression Display Rule Style Area: Graph to be visible, then you must have selected Markers to be visible. The line itself will not change color depending on the display rule definition, only the markers, as you can see which filled circles are light green and dark green.
Now, for the Style Area: Background, you do not have to have Options: Markers turned on, but it makes it easier to see which data values are in the background display rule bands.
Now let’s look at the Treemap and Word cloud objects again. We saw these earlier in the Color-mapped Value Display Rule section and we saw that if there was a Color Data Role assigned, then the Color Data Role took precedence over the Color-mapped Value Display Rule.
The good news is, when an Expression Display Rule is defined for these objects; it is the measure being evaluated and the display rule will be applied successfully even if there is a Color Data Role assigned. The object will display an Informational Warning letting us know that This report object uses rules that might conflict with essential color mapping. Use the Rules pane to remove the conflicts. This warning just lets us know that the object has default coloring based on Data Roles but that there are Display Rules which might negate the values.
Remember, one of the great things about using an Expression Display Rule is that all the measures in the data source are available to use in the expression definition even if that measure is not assigned to a Data Role in that object.
In this Treemap example, I do have the Expenses assigned to the Size Data Role.
In the Word cloud example, I do not have the Expenses assigned to a Data Role. I used the same category data item, Product Description with the same Expression Display Rule definition for Expenses so you can see how the same values are colored.
Now let’s look at an example where an object has both a Style Area: Graph and Background display rule definition. Here I am using a Dual axis bar-line chart object. We can see how I have two different display rule definitions for each type of style area. Also notice, that in order to see the Style Area: Graph be applied to the Line chart, the Markers must be enabled.
In this next example, I am also visualizing the category data item Month of Year but this time only the measure Unit Yield (rate). Notice that I have the same Expression Display Rule definition but for the Key value object there is no Style Area option.
I have two last Expression Display Rule examples I will show, both Geo map objects. The first is using the Geo region object. Now typically, when the Color Data Role is assign, the display rule will not be applied, but in this case, using an Expression Display Rule we can see that the regions are colored per the display rule definition.
Next is the Geo coordinate map object so that I can show another icon example. As you can see here, I have an Expression Display Rule defined for the Expenses data item but this time I have two different icons: a sad red face for Expenses > 5M and a happy green face for Expenses <=5M.
Summary
We have now explored many of the available Graph – Level Display Rules. I hope that by seeing some of these examples you can determine how to incorporate meaningful color into your reports!
Report - Level
Table – Level
Graph – Level (this article!)
Gauge - Level
Here are some key things to remember for the Graph – Level:
Graph - Level
Color-mapped Value
Expression
If there is a Color Data Role assigned, then this value takes precedence over the defined display rule.
Usually, you can use any measure available in the data source and it does not always need to be assigned a Data Role in the object.
Some graph objects will have the option to define a Style Area: Graph or Background.
Here is a list of the supplemental enablement materials I mentioned in this article as well as other helpful resources:
Get to know the List Table
Creating Hierarchies to use in SAS Visual Analytics Reports
SAS Visual Analytics Cell Graphs to enhance List Tables and Crosstabs: Article | YouTube
SAS VA Report Example: Add a scope to an aggregated measure: Article | YouTube
Use Report Themes to quickly change your data color palette
SAS VA: Use Custom Categories to create user-defined categories for dates, measures, or categories: Article | YouTube
SAS VA: Automatic Actions Part 1 – Easy exploration for multiple data sources: Article | YouTube
SAS Visual Analytics 8.1: Configuring prompts with different source data: Article | YouTube
Tips for working with multiple data sources in SAS Visual Analytics: Article | YouTube
SAS Visual Analytics Report Examples using Container Objects: Article | YouTube
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels:
05-11-2023
05:32 PM
1 Like
This is the second post in a series about the available Display Rules in SAS Visual Analytics.
Report - Level
Table - Level (this article!)
Graph - Level
Gauge - Level
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.
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:
Select the target object in the report, in this example, the List Table Object.
Then open the Rules pane.
Select + New rule.
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.
Next, start typing the case sensitive string value. A list of available values will appear for the selected data item.
Select the color to be applied when the display rule condition is true.
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.
Here is how each of those Placement positions would look in this example List Table for a Color-mapped Value Display Rule.
List Table – Expression Display Rule To define an Expression Display Rule for the List Table Object, you start with the same steps:
Select the List Table Object you want the Rule defined for.
Select the Rules pane.
Click + New rule
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.
Next we must define the Display Rule Expression. Let’s walk through these steps.
Rule Type: Expression
Label: This will display in the Rules pane when viewing the report.
Operator: Select the Boolean operator to use when comparing the current aggregated value to the Value defined in the next step.
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.
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.
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.
Here is how each of those Placement positions would look in this example List Table for an Expression Display Rule.
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:
Here is how to define a Gauge Display Rule
Select the target List Table object to make it the active object.
Open the Rules pane.
Select + New rule
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.
Now we must define the gauge expression:
Rule Type: Gauge
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.
You can adjust the number of intervals if you wish and manually overwrite the Lower and Upper bounds with a custom value.
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.
Gauge type: Bullet
Column for the gauge to be placed in. In this example, we will keep the gauge next to the data item it represents.
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.
Here are how all of the available gauges look for the same measure, Expenses, and with the same interval definitions.
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.
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:
Select the Crosstab to make it the active object.
Open the Rules pane.
Select the + New rule menu.
Select Any Measure.
Then you must:
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.
Operator: Select the less than sign.
Value: Enter the number zero. Notice that you could select from one of the measures assigned to the Crosstab or a parameter.
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.
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.
Placement: The only available placement for this display rule is the Cell.
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.
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.
Select the Crosstab to make it the active object.
Open the Rules pane.
Select the + New rule menu.
Select Expenses.
In this display rule, we will have to specify an intersection.
Label: This will display in the Rules pane when viewing the report. To represent this rule I will label it Greater Than 500K.
Operator: Select the greater than sign.
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.
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.
Format: In this example I selected a light red background color.
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.
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.
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.
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.
Here is a list of the supplemental enablement materials I mentioned in this article as well as other helpful resources:
Get to know the List Table
Creating Hierarchies to use in SAS Visual Analytics Reports
SAS Visual Analytics Cell Graphs to enhance List Tables and Crosstabs: Article | YouTube
SAS VA Report Example: Add a scope to an aggregated measure: Article | YouTube
Use Report Themes to quickly change your data color palette
SAS VA: Use Custom Categories to create user-defined categories for dates, measures, or categories: Article | YouTube
SAS VA: Automatic Actions Part 1 – Easy exploration for multiple data sources: Article | YouTube
SAS Visual Analytics 8.1: Configuring prompts with different source data: Article | YouTube
Tips for working with multiple data sources in SAS Visual Analytics: Article | YouTube
SAS Visual Analytics Report Examples using Container Objects: Article | YouTube
Find more articles from SAS Global Enablement and Learning here.
... View more
- Find more articles tagged with:
- GEL
Labels: