BookmarkSubscribeRSS Feed

How to prompt for a date range in a SAS VA report – Example 3 Drop-down list

Started ‎04-24-2020 by
Modified ‎06-04-2020 by
Views 5,309

I’ve broken this topic down into a four part series to make it easier to consume and to save you from copious amounts of scrolling. The accompanying video tutorial is already available and the below examples are linked to their corresponding timestamps in the video.    

 

The control objects and examples I will cover in this series include:

 

Example 3: Drop-down list

In this example, I will prompt the user to select two date values formatted using Month Year (MMMYYYY). The list table will use these values as low and high boundaries for a between inclusive filter condition which will return consecutive weeks in the object. To show case a different filter, the bar chart on the other hand, will use these values to compare the two selected values rolled up to the month level.  

 

01_Example3_Report_updated.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.

 

You may be wondering, why use the drop-down list instead of the slider (range)? Here are a few reasons:

  • The slider, when not in a report or page prompt area, can only be configured as an Action to a target object for either filter or linked selection. There is no way to configure a filter condition for the slider (range) to use the boundary values individually.
  • If you have several hundred date values, the slider (range) end points become difficult to maneuver. The calendar picker does help, but sometimes using a drop-down list can be more user friendly.
  • The need for flexibility to customize the filter expression to use between inclusive or exclusive, outside inclusive or exclusive, for days greater than or less than the boundary, the options are many. In short, this allows for greater customization and precision when the report requirement calls for it.

    

The technique used in this example will follow these steps:

  1. Add two Drop-down list control objects to the report canvas and assign Roles
  2. Create two parameters and assign to the control objects’ Roles
  3. Define Filters for report objects

   

Step 1: Add two Drop-down list control objects to the report canvas and assign Roles

Use the page’s overflow menu to Expand page controls so that it is easy to see where you are dragging the Drop-down list control objects. Do not place the control object in the Page prompt area, but directly under it in the report canvas.  

 

Remember, we need two! I placed mine side-by-side.  

 

02_Step1_AddDropDownListControls.png

 

Next, we need to assign the Roles and use the object’s Title Option to label our control objects to assist our report users.  

 

Here is the first control object:  

 

03_Step1_AssignRolesFrom.png

 

And here is the second control object:  

 

04_Step1_AssignRolesTo.png

 

Step 2: Create two parameters and assign to the control objects’ Roles

Now we will need to create two parameters to store the selected values from the Drop-down list control objects so that we can use these values in our filter expressions.  

 

From the Data pane, use the New data item menu and select Parameter. Enter the new parameter information for the date data item. Be sure to select the correct Type and Format.

 

05_Step2_CreateParameters.png

   

Repeat for the second parameter. Be sure to give the parameters meaningful names.

 

06_Step2_SecondParameter.png 

 

Next, we need to assign these parameters to their corresponding Drop-down list control objects’ Roles so that it stores the value selected.  

 

07_Step2_AssignParametersToRoles.png

 

Step 3: Define Filters for report objects

Now we have our date boundaries which are being selected via the Drop-down list control objects and stored in our two parameters. Next we need to define and apply our Filters to our report objects.  

 

First, we will define the filter for the List Table object. Recall that we want this to be a between inclusive for our two boundary values. Select the List Table object and then use the Filter pane and from the New filter menu select Advanced filter.  

 

08_Step3_ListTableFilter.png

 

Next, build the filter expression for the Month Year date data item using the between inclusive condition and our two parameter items as the lower and upper boundaries.  

 

09_Step3_ListTableFilterExpression.png

 

Now we can build our filter for the Bar Chart object. This is where we want to compare the two selected months and therefore, will use a different kind of filter from the between inclusive, we will use an or condition.  

 

With the Bar Chart object selected, use the Filter pane and from the New filter menu, select Advanced filter.  

 

10_Step3_BarChartFilter.png

 

Next, build the filter expression for the Month Year date data item using an OR condition for both parameter values.  

 

11_Step3_BarChartFilterExpression.png

 

Success! Now test it out. You can see the list table object returns the between inclusive weeks for the date boundaries and the bar chart compares the two selected date values.  

 

12_Example3_CompareMarch2018v2019-1024x832.png

 

 

Here’s a summary of the technique for Example 3: Drop-down list:

  1. Add two Drop-down list control objects to the report canvas and assign Roles
  2. Create two parameters and assign to the control objects’ Roles
  3. Define Filters for report objects

   

How to prompt for a date range in a SAS Visual Analytics report Series:

     

Other References

       

Comments

Merci pour toutes ces explications bien explicites.
Mais les périodes de validité se chevauchent, si je choisi une date_begin bien précise, la date de fin va etre filtrée selon ce qu'il y a dans la table.
Alors qu'il y a peut etre une autre ligne qui pourrait etre afichée.
Voici une partie des dates de validité

Olivier_Deprez_0-1713962770549.png

 

Version history
Last update:
‎06-04-2020 01:03 PM
Updated by:
Contributors

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Free course: Data Literacy Essentials

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

Get Started

Article Tags