Many BI developers don’t realize they can code information maps without ever touching Information Map Studio. Using the INFOMAPS procedure you can do everything from creating an information map to updating an existing one. This post explains the basics of creating and updating an information map.
Using Information Maps with a Dashboard
If you are building a dashboard based on RDBMS data, then you might already know that you have to use an information map to reach the data directly. Some customers use this technique when they want to have near-real time data. They create a view in the database and access the view when needed. As the database updates its table during the day, the data can be refreshed.
Here’s a sample dashboard (used with Adding Images with Your Dashboard post). Most of the data tables used with these indicators are fairly simple because they only contain a few data items. For instance, look at the Top Search Terms (Today) indicator (bottom right). This indicator only has 3 variables: search term, visitors, and rank. (You cannot see the rank variable, it is used to sort the terms.)
Like many dashboard indicators, the data variables are summarized and small. Since the indicators use such small datasets and information maps, it is a lot easier to code the information maps.
Planning Your Dashboard Data Support
For my example, here’s the design that I used while planning the dashboard. The indicators all use information maps as the data source. The following figure shows you how I planned the dashboard layout [More Dashboard Layout Tips]. Basically, its 3 datasets to support 3 information maps.
Tip! Generally, I prefer for each indicator to have its own data source. This way is something changes and the indicator needs to move or be deleted, you can do so without affecting other indicators.
Code Your Information Map
After register your data or view in the metadata, you can write your information map code. Here’s what the Search term base table looks like – it has three columns that have the top search terms for the day, with the count, and then a rank. Next we need to create the information map that is shown in the preceding figure as Info Map #3.
Here’s some code to create Info Map #3 Top Search Terms, which I call “Dashboard Searches”. I wanted all the variables and a filter that would allow me to just pull the top 5 searches. I included the filter for when I wanted to limit the results later.
/*Use these options to control multiple metadata connections */ /*This section needs to be updated to match your site. */
OPTIONS metauser="User_id" /*Your User ID or preferred one*/ metapass="your_password" /*Associated Password*/ metaserver="sas-server" /*Server Name*/ metaport=8561 /*Typically this port*/ ;
/* Start the Information Map Definition */
proc infomaps ; new infomap "Dashboard Searches" /*Info map name*/ mappath="/Shared Data/Maps" /*Metadata storage location for map*/ auto_replace=yes;
/* Load the table and all variables into the map . */ insert datasource sasserver="SASApp" table="Blog"."DB_SEARCHES" _all_ /* Use "_all_" to load entire data set */ id="T1" /*Folder name in info map*/ ;
/* Create a filter for the Location data item. */ insert filter name="Top 5 Searches" condition=" <<T1.Rank>> < 6 "; /*Put expression in quotes*/
/*Saves to the location in mappath above*/ save;
Note: Click here to see the log result.
Here’s the resulting information map in Info Map Studio (click for larger image). Notice that it added the filter and that it created a folder called T1. I only opened Information Map Studio to get a screenshot for you! In this case, the code was a lot less work.
Here’s some observations:
- It renamed my variable “search_term” to the nicer “Search Term”.
- It understood which variables were numeric and character.
- Placed all the variables in the a folder called T1, which I was only using as a shortcut name to reference the Rank variable during the filter creation.
Adding the Information Map as an Indicator with the BI Dashboard
In your dashboard, when you create the indicator, select information map as the data source. Then use the Browse button to find the map you want to use. You can use the arrows to indicate which items you want to use in the dashboard. Click the Apply Query Changes button to create the data.
The filter I created was optional – if I want to use it I would add it to the Filters area.
For a more complete discussion about the INFOMAPS procedure, refer to the BASE SAS 9.3 Guide to Information Maps documentation.
Stay Tuned for Part II …
Stay tuned for Coding Information Maps Part II. I’ll have some more tips that I learned while coding the information maps for the dashboard.
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.