3 Killer Tips for Coding INFOMAPS for Your BI Dashboard
In Using the INFOMAPS Procedure Part 1 post, I showed you how to code a simple SAS information map with a filter for use with BI Dashboard. In this post, I’ll show you some additional tricks for using PROC INFOMAPS that are intended to work with a dashboards.
Tip #1: Careful when Using An Information Map with BI Dashboard
When you use an information map as the source for the dashboard, it is sensitive to any changes that are made. When you have code – you probably just rerun the code to recreate the map instead of opening Info Map Studio to make the change. If you make a change to a data item, most likely, you’ll see a query error for the indicator data similar to the following figure:
You will have to re-add the information map that has the changes. The easiest trick I discovered was just selecting a different data source (such as data table) and re-selecting the information map choice. Then I was able to load the information map with the changes.
Obviously you cannot plan everything but just be aware of this limitation and ensure the information map is extremely close to what you want.
Tip #2: Updating a Data Item Format for the Dashboard
In the earlier example, we created an information by adding all of the data items at once. However what I noticed is when you use information maps as a source, it uses the format associated with the information map. So make sure you set the format you want before you create the indicator. It just makes it easier.
Things that Went Wrong
Here’s an example. For the dashboard I had two indicators at the top that used the same information map, which I called General Statistics. This figure shows the planning on the top and the actual result on the bottom. Notice that the indicators are very similar, the only difference being that one table uses a comma format (Value) and the other table uses a percent format (Value (%)).
Creating a New Variable
The first time I created the data table for the General Statistics information map – I only had 4 columns: Timestamp, Metric, Value, and Range. My plan was simply to change the format in the dashboard indicator so that one indicator used comma and the other used a percentage. However, I didn’t realize the dashboard would not let me change the format in the table.
The indicator wants to use the format from the information map. So, I had to add a new column with the values as percentage, shown in the following figure. This table then had 5 columns: timestamp, metrics, value, value_pct, and range.
Updating the Information Map Code
I updated my information map code so it would have the format I wanted. As you may recall in my original code, I use the _ALL_ option on the INSERT DATASOURCE statement to have all of the data items in the dataset used in the information map.
Since I want to change the default, I used the UPDATE DATAITEM statement to set the format. Since these are numbers, they are classified as measures by default – but I added the CLASSIFICATION option for demonstration purposes.
To update the item, you have to use the name from the information map, not the data table. So in this instance, note that VAL_PCT is the variable name in the table but the information map called it VAL PCT (no underscore).
/*Create the Information Map */
proc infomaps ;
new infomap "Dashboard All Metrics"
/* Add all variables to the info map */
insert datasource sasserver="SASApp"
/*Update Measures to desired format */
"Val Pct" /*Use data item as it appears in info map not dataset*/
/*OPTIONAL: Insert other code here*/
/*Saves to the location in mappath*/
Now when I load my information map, you can see the values are properly formatted with comma or percentages.
Here’s another tip – if you use SAS Enterprise Guide 5.1+ it will help you with the PROC INFOMAPS code. When you start typing, it will suggest some of the items you want. If you don’t have SAS Enterprise Guide 5.1, then just check the Infomaps procedure user documentation.
Tip #3: Insert a Multi-Item Filter with Ease
I used two tables for the General Statistics because I knew the formatting (comma vs percentage) would be a display issue. I added two filters to the map to ensure I could have the variables with the comma in one table and the variables without in the second table.
The following code was inserted before the SAVE statement in the above code. To ensure I was able to get two values at once I had to use an In operator with the values in quotes. This was not obvious from the examples in the documentation. So I just wanted to show it here.
/* Create a filter for the each metric. */
name="Filter: No Percent"
condition="<<T1.Metric>> in ('Visitors','Actions') ";
name="Filter: With Percent"
condition="<<T1.Metric>> in ('Conversions','Bounce Rate') ";
I had to create two different indicators, once that allowed had the values with the commas (Visitors and Actions) and the other for the percentages (Conversions and Bounce Rate). Here's the result.
The SAS user documentation shows you how to use the PROC INFOMAPS to join tables, aggregate values, and other tricks that you might want to use for your information map.
Learn all about SAS BI
You can learn more about SAS Business Intelligence from the "SAS BI Bible." Take a peek inside the Building Business Intelligience with SAS book.
Never miss a BI Notes post!
Click here for free subscription. Once you subscribe you'll be asked to confirm your subscription through your email account. You email address is kept private and you can unsubscribe anytime.
Latest posts by Tricia Aanderud (see all)
- Use these 7 Data Storytelling Examples to Make Your Insights more Meaningful Today - 2018-06-09
- Use Network Analysis to Understand Your Customers with SAS Visual Analytics 8.2 - 2018-01-21
- My 7 Favorite Features in SAS Visual Analytics 8.2 on Viya - 2018-01-14
- Designing Dashboards: Finding the Fantastic Five Colors - 2017-06-19
- Creating a Web Analytics Report in SAS Visual Analytics 8.1 - 2017-06-19