BookmarkSubscribeRSS Feed

SAS Visual Analytics: How to add a filter to a report

Started 3 weeks ago by
Modified 3 weeks ago by
Views 310

If you are new to SAS Visual Analytics, and you’ve come across this article, I hope it’s because you’ve searched for how to add a filter to a report. Every tool has its own terminology and SAS is no different. Let’s look at the different ways you can add a filter to your report.

 

  • Filter pane
    • Basic filter
    • Advanced filter
    • Common filter
  • Prompt user via control objects

 

Filter Pane

 

First let’s look at a direct filter applied using the Filter pane. This is a filter that is typically applied by the report designer and is not directly apparent to the report viewer that it is applied.

 

Basic filter

In this example, I have a bar chart where Year is assigned to the lattice row Data Role and Country is assigned to the group Data Role. In the right-hand screenshot, I have applied a basic filer to only return the Year 1994. This is called a basic filter as it only uses one data item in the Boolean expression.

 

Notice that in only viewing the bar chart, there is no indication there is a filter applied.

 

01_BarChartWithBasicFilter.jpg

 

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

 

 

Here’s a quick look at the steps to apply a basic filter:

 

  1. Select the bar chart to make it the active object.
  2. Open the Filters pane.
  3. Select New filter.
  4. Since we are building a basic filter, select the Year data item.
  5. Open the Year filter toolbar menu.
  6. Select Filter using discrete values.
  7. Make sure only the value 1994 is selected as the filter value.

 

02_TP_AddABasicFilter.jpg

 

Advanced filter

In this second example, I have the same bar chart where Year is assigned to the lattice row Data Role and Country is assigned to the group Data Role. In the right-hand screenshot, I have applied an advanced filer to return the Year 1994 and the Country Canada. This is called an advanced filter as uses more than one data item in the Boolean expression.

 

Still notice that in only viewing the bar chart, there is no indication there is a filter applied.

 

03_TP_BarChartWithAdvancedFilter.jpg

Here’s a quick look at the steps to apply an advanced filter:

 

  1. Select the bar chart to make it the active object.
  2. Open the Filters pane.
  3. Select New filter.
  4. To build an advanced filter, select Advanced filter.
  5. Use the expression editor to build the compound Boolean expression. Notice how the expression editor indicates how many observations are returned for the filter.

 

04_TP_AddAnAdvancedFilter.jpg

 

Common filter

Once you configure a filter for a single object, you can share that filter with other objects in your report that share the same data source.

 

I have a dedicated article to this feature and an accompanying YouTube.

 

 

Prompt user via control objects

 

The second way we can filter objects in a report, is to prompt the user to select a value. In order to prompt a user, we must use a Control object.

 

If you place the control object in the report or page prompt area, then a filter is automatically applied to all of the objects in the report or page if the same data source is used or you can configure a data source mapping between different sources. Otherwise, if the control object in in the report canvas, then you must manually configure an Action to filter the target object or objects.

 

Prompt

Type

Filter Behavior
Report prompts Automatically filters all objects in the report, across all pages, with the same data source automatically or can configure data mapping for different data sources.
Page prompts Automatically filters all objects in the current page with the same data source automatically or can configure data mapping for different data sources.
Canvas prompts Do not automatically filter any objects. A filter Action must be configured. Able to configure data mapping for different data sources.

 

05_TP_PromptAreas.jpg

 

I have a dedicated article and accompanying YouTube for Configuring prompts for different data source.

 

Control objects

Here are the available control objects:

 

  • Button bar
  • Drop-down list
  • List
  • Slider: single value or range (shown)
  • Text input

 

06_TP_AvailableControlObjects.jpg

 

Page prompt

Let’s look at adding a control object to a page prompt so that it automatically filters all of the objects on the page that use the same data source. Refer to the linked article or YouTube for more detail on how to configure prompts that use different data sources.

 

  1. Use the arrow to expand the Page prompt area.
  2. From the Objects pane, drag the Button bar control object to the Page prompt area.
  3. Use the Assign data button to select a Data Role assignment.
  4. In this example, I selected Year for the Category Data Role assignment. Click Close.

 

07_TP_AddAPagePrompt01.jpg

 

08_TP_AddAPagePrompt02.jpg

 

Now we can test our prompt. In this first screenshot, this is how both objects appear with no filters applied. We can see both years in the stacked bar chart and in the crosstab objects.

 

When I select the year value 1994, both of the objects are filtered automatically because the control objects is placed in the page prompt area and both objects use the same data source. Therefore, no additional steps are needed.

 

09_TP_TestPagePrompt.jpg

 

Canvas prompt

Now let’s add a canvas prompt which will require an additional step, to manually configure the filter Action. I will add it to what we already have in our report, and I will prompt for Product.

 

  1. From the Objects pane, drag the List control object to report canvas.
  2. Use the Assign data button to select a Data Role assignment.
  3. In this example, I selected Product for the Category Data Role assignment. Click Close.
  4. Click on the List control object to make sure it’s the active object.
  5. Open the Actions pane.
  6. Select the target objects you want the List control to have a filter action on. In this example, select both the bar chart and the crosstab objects.

 

10_TP_AddCanvasPrompt01.jpg

 

11_TP_AddCanvasPrompt02.jpg

 

12_TP_AddCanvasPrompt03.jpg

 

13_TP_AddCanvasPrompt04.jpg

 

14_TP_AddCanvasPrompt05.jpg

 

Success! Now you can select different values in the list control and watch how both objects get filtered.

 

15_TP_TestCanvasPrompt.jpg

 

 

Conclusion

 

I have now shown you two ways to configure a filter for objects in a Visual Analytics report; using the Filter pane or prompting the user to select a value using control objects.

 

Here is a list of additional resources:

 

 

 

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
3 weeks ago
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Labels
Article Tags