We’re smarter together. Learn from this collection of community knowledge and add your expertise.

How to use drop-down lists for parameter filtering in SAS Visual Analytics: Abandoned shopping carts example

by SAS Employee Mike_Drutar on ‎01-17-2017 01:57 PM - edited on ‎01-17-2017 01:59 PM by Community Manager (2,187 Views)

One of the most powerful features within SAS Visual Analytics is the ability to leverage parameters to search text strings.  This is best demonstrated in the blog post, Using parameters in SAS Visual Analytics, by Teri Patsilaras.  In the post's third (complex) example using web data, Teri explains how to create and use a character parameter to dynamically filter other data objects.  This is a fantastic tip and shows that by leveraging a character parameter, you can input a specific search query into a text field, and the parameter will filter other objects and areas in the report.  

 

I was recently working with a colleague when a need for this type of filtering came up, but the intended report consumers were not familiar enough with the data to know what to type into the search field.  If the report consumer is not a subject matter expert on what the contents of the data to be searched are, it might be difficult to natively type a search term.  Let me show you how a drop-down list can help through an "abandoned shopping carts" example.

 

With the busy shopping season behind us, a common topic in the news is "Abandoned Shopping Carts" in online shopping. As you might guess, this refers to when a customer was shopping for an item online, and found an item they were interested in.  They added the item to their "cart" in the online store, but never checked out.  The shopping cart is "abandoned."  Figuring out why customers abandon shopping carts (and therefore why customers spend less money) is valuable data for online retailers.  

 

For today's example, let's imagine that we work for an online retailer and have surveyed our customers on why they didn't finish the checkout process.  The survey asked the customers to disclose the three top reasons why they 'abandoned' their shopping carts (Reason 1, Reason 2 and Reason 3).  I've created some fictitious data from the survey in the below dashboard that has the three reason columns along with the revenue loss for those reasons.

 

 

01_PRD.png

 

First, let's use Teri's trick and create a character parameter (named "Search") assigned to the text input box.  This parameter filters the results table below.  However instead of the parameter just searching one field, we have written the filter out to search all three reason fields.  By selecting the "Abandoned Shopping Cart Survey Results" table and clicking the "Filters" tab on the right, we can see how the filter looks:

 

02.png

 

Notice how using the Boolean logic, we are leveraging the "Search" parameter to return values that could be in Reason 1, Reason 2 OR Reason 3 fields.  This is great because now, if you want to see if anyone had abandoned their carts due to issues surrounding "Lack of Customer Support," you can type that into the search field on the report.  The filter above will return the rows where "Lack of Customer Support" appears in ANY of the three columns:

 

03.png

 

Pretty sweet!

 

But, we can improve this even more.  Suppose the report user hasn't seen the survey responses and is unfamiliar to the reasons why a customer would abandon their cart.  If this is the case, the report consumer might now know what to type in the search field.  For example, I am looking at this report and the first thing I think to try and search on is "Too Expensive" (I'm a fairly stingy shopper!).  When I type "Too Expensive" into the search box, I get no results:

 

04.png

 

As a report user, I would like to have a dropdown that has all of the possible answers the survey takers could submit.  This way, I don't waste time searching for values that are not in the data.

 

This functionality is possible by leveraging a lookup table with the all the possible answers.  Then using the values from this lookup table in dropdown control.  This is demonstrated below:

 

05.png

 

However the issue here is, when I go to create my interaction between the dropdown control (using the lookup dataset) and the table (which leverages the "Abandoned_Shopping_Cart" dataset) it will ONLY allow me to map the "Reason" Field to one of the three "Reason" Fields in the results table.

 

06.png

 

So by leveraging interactions alone, we can't get the functionality we want: having the "Reason" column from the dropdown filter all three Reason Columns in the results table.  However we CAN get the functionality we want by leveraging the "Search" Parameter in our dropdown control.  

 

Below I have deleted the text input box from the original report.  Next, I select the dropdown control which has the "Reason" column and from the roles tab, I have added the parameter "Search" to the Parameter Role:

 

07.png

 

With the Search parameter in place, we now can leverage the filter we created earlier, but also can give the report consumer a list valid filter options to choose from. Now when I choose "Lack of Customer Support" from the dropdown, it filters the table with the Boolean OR logic that we created previously:

 

09.png

This is the best of both worlds! Via the dropdown, we can offer the report consumer a valid list of filter values.  This avoids the problem of a report consumer not knowing what to type in for search input (i.e. the "Too Expensive" example that returns no results). But by leveraging the parameter and filter, we can have one dropdown search across multiple fields (Reason 1, Reason 2 and Reason 3 in this example).

 

How to make the example work for you

This example was created in SAS Visual Analytics 7.3. Attached is a SAS package file containing the report and as mentioned before, the data is provided as a SAS Datasets. Load both SAS Datasets into memory on your SAS Visual Analytics instance and you'll be able to import this package if you have access to the SAS Management Console 7.3. Please refer to these instructions.

 

10.png

 

 

 

Attachment
Contributors
Your turn
Sign In!

Want to write an article? Sign in with your profile.


Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.