Like any good SAS professional, I subscribe to the SAS Samples RSS feed. The other day I found this sample that shows how to create a PDF report about the contents of a SAS Information Map.
It's a nice example: it shows how to use the INFOMAPS engine and ODS to create a simple report to show what's in an information map. But we can do much more. Information Maps are a richer data source than regular SAS data sets: they can contain calculations, folders, filters, and more.
Here is an example that I wrote that shows:
- Information maps in a particular SAS folder
- The data items for a particular map, including the folder hierarchy, item type (category or measure), description, and SAS syntax name
- The list of filters, if any, that are defined for the information map, including folder hierarchy, descriptions, and an indication as to whether the filter includes one or more prompts
The example uses the new Information Map dictionary tables that were added in SAS 9.2. (Note: this example reports only on relational information maps, not OLAP. The INFOMAPS engine does not support OLAP data sources.)
The complete SAS program is available here, and this link is an example of the result. The following picture is an excerpt from the report you'll get.
If you want to create a SAS program that reads the actual data rows from a map, that's easy. Use SAS Enterprise Guide to open the Information Map into your project. You'll wind up with a task and SAS program as part of your process flow. You can run the task just as it is, or copy the code and adapt it for your own use.
7 Comments
This is a very usefull tip. But, how do I programmatically determine the data table the Information map is dependant on?
That is a good question. Unfortunately, that's not part of the information that you can get to via the dictionary tables. For this, you might try PROC INFOMAPS and the LIST statement.
http://support.sas.com/documentation/cdl/en/engimap/61078/HTML/default/viewer.htm#a003052358.htm
Yes, just confirmed this. Try something like:
proc infomaps ;
update infomap "Cars" mappath="/Shared Data/Maps";
list datasources;
run;
The output goes to the SAS log:
Total datasources: 1
Data source: Sample Data.CARS_1993
ID: CARS_1993
Name: CARS_1993
Description:
Pingback: Five strategies to eliminate passwords from your SAS programs - The SAS Dummy
Pingback: Which tables contribute to that SAS information map? - The SAS Dummy
Thanks Chris for your usefull tips and community work. It helped me a lot and maybe this will help you or others:
We have hundrets of Enterprise Guide files and SAS code files accessing our information maps. We needed a fast way to get an overview of what information maps and variables are used. It is for some kind of impact analysis: If an information map or even a variable is changed, we need to know, whats the impact to our hundrets of SAS projects and codes.
Although the INFOMAP engine is powerfull and the proper way of doing things, I wrote a python script which scans several Windows directories for SAS code blocks. This is not perfect, but might be of use to someone else. Therefore I share it on github: https://github.com/grandgrue/sas-infomap-scan
Clever - and well done!