BookmarkSubscribeRSS Feed

Tips for working with multiple data sources in SAS Visual Analytics

Started ‎04-01-2021 by
Modified ‎04-30-2021 by
Views 9,449

Long gone are the days where a SAS report is restricted to a single data source. Now you can have an unlimited number of data sources but don’t treat this as an all you can eat buffet. Just as your stomach has limitations so does your SAS environment. What’s the recommendation? Well it will depend on several factors such as:

 

  • size of your environment
  • size of your data
  • number of users
  • report design

 

but the ultimate goal is that you want responsive meaningful reports. I want to focus on the aspect of working with multiple data sources in a SAS Visual Analytics (VA) report. But for overall report design consideration SAS put together a guide, Beautiful Reports, and it contains great ideas for designing effective reports.

 

If you are new to SAS Visual Analytics then it can be a little overwhelming to figure out the exact click pattern to maximize your efficiency and eliminate frustration. Keep reading and soon you’ll master the order of operations in SAS VA just as you did for math using PEMDAS: Please Excuse My Dear Aunt Sally. Though in finding the Wikipedia link for reference, I learned other parts of the world use different mnemonics!

 

Add a Data Source to a VA Report

From the Data pane use the Data menu and select Add data.... Then use the Choose Data window to select the data source to add to the report.

 

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

 

Or you can use the drop-down arrow and use the + Add data… option. From the drop-down arrow you can see all of the data sources that have been added to this VA report.

 

02_ListOfDataSources.png

 

Object Tips

SAS Visual Analytics Objects can only have one data source. While the SAS VA report can have multiple data sources each individual object can only resolve data items from one data source. The easiest way to toggle between data sources and assign data roles, is to:

  1. Select the target object – critical first step!
  2. Select the desired data source from the Data pane
  3. Use the Assign Data button on the object or use the Roles pane

 

03_AssignDataRoles1.png

 

04_AssignDataRoles2.png

 

Prompting with Multiple Data Sources

When you have multiple data sources added to a VA report, you may want a single prompt, called Control Objects to filter more than the source data source. To do this you will need to Map data sources.

 

Check out this article here for additional examples: SAS Visual Analytics 8.1: Configuring prompts with different source data: Article | YouTube.

 

There is a report wide Map data... setting available from the Data menu where you can define the column mappings between each of the VA report data sources.

 

05_MapData.png

 

Combining Data Sources

There may be a time when you really want to include more than one data source in a single object, say a List table or Crosstab. What are your options? Answer: create a new data source by joining the tables. Not familiar with joining tables in SAS Visual Analytics, then check out this article here: VA 8.3 Join Tables in VA Reports.

 

I won’t rewrite the entirety of that article here but give a few additional pointers. Remember that joining tables will result in the combination of additional columns and will not append rows based on join criteria. In my current report example, let’s say I want to join the two regions North and East. I’ve filtered all the data for the year 2020 so that it’s easier to see, here is what the source tables look like and then the resultant join.

 

There are missings in our join result because we are joining two disparate values for Facility Region. Even though Facility Region was listed in the join criteria, there is never a row in the North data source that would equal East and that is why you are seeing the sparse result.

 

 

06_DataJoin1.png

 

Creating a few basic Calculated items we can get the desired result and have our two separate data sources appear as one in a single object.

 

 

07_DataJoin2.png

 

 

 

 

08_DataJoin3.png

 

To come full circle with the example, if you had one Facility Region, West where there were two separate data sources for Profit and Expense then this join result would look like this.

 

09_SimpleDataJoin.png

 

Ultimately, always take the time to double check your join result numbers using a List table object against the incoming data sources.

 

Adding Footer Information about each Data Source

If you’re not familiar with the Text object check out this article: Using Dynamic Text in a VA 7.4 or 8.3 Report. Two of the neat features of the Text object I want to mention here are the Table Modified Time and Interactive Filters dynamic auto populated information. These pieces of information are helpful to communicate either the status of the data or what filters are being applied to the data to report users.

 

The key point you need to keep in mind is that you cannot put multiple data source information in a single Text object. You will need one Text object per data source if you wish to add this information to your report. In my example below, I placed three Text objects along the bottom of the report to create a footer.I added the border style in black so that you could see the three different objects easily, if you did not add this it would look like a nicely spaced single footer.

 

In this screenshot, I also used different color font to highlight the point that these are different data sources with different table modified times, i.e. when the tables were last updated in CAS.

 

10_Footer.png

 

Summary

You should now have a better understanding of how to work with multiple data sources. Bear in mind that your computing resources are finite and while you can have an infinite number of data sources, try to stick to a hand full and link out to other reports once you hit your maximum acceptable response time.

 

You should have the order of operations memorized for assigning Data Roles :

 

  1. Select the target object – critical first step!
  2. Select the desired data source from the Data pane
  3. Use the Assign Data button on the object or use the Roles pane

 

And link out to these resources for additional examples and step-by-step instructions:

 

Here’s a look at our example report with each of these techniques applied.

 

11_FinalReport.png

 

Demo

I have recorded an accompanying video tutorial for these examples so that you may follow along.  Though the video uses SAS Visual Analytics on Viya 4, similar steps can be used for earlier releases including SAS Visual Analytics 7.4 and later, but the Data Join feature is available for releases 8.3 and later.

 

 

 

Find more articles from SAS Global Enablement and Learning here.

Version history
Last update:
‎04-30-2021 04:57 PM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

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

 

Register now!

Free course: Data Literacy Essentials

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

Get Started

Article Tags