Have you ever wondered how infographic segments such as the following were created using SAS Visual Analytics:
This visual is used in examples such as The Global Findex Database in SAS Visual Analytics and is a great tool to visualize percentage without the use of key values or textural information. The following illustrates the steps required to create such visualization.
While you could integrate required data into your business data, for reusability I decided to create a separate data set. The following data step can be executed in SAS Studio and creates a number of different grid sizes, related coordinates and percentages. We will later choose a desired grid size given our business data:
cas;
caslib _all_ assign;
data work.infographic;
do grid_counter=3 to 12 by 1;
cell_grid=catx(' ', catx('x', put(grid_counter, 8.), put(grid_counter,
8.)), 'Grid');
cell_num=0;
do cell_y=grid_counter to 1 by -1;
do cell_x=1 to grid_counter by 1;
cell_num=cell_num + 1;
cell_char='C' || put(cell_num, z2.);
cell_pct=cell_num / ceil(grid_counter ** 2);
output;
end;
end;
end;
format cell_pct percent12.;
drop grid_counter;
run;
proc casutil;
droptable casdata="INFOGRAPHIC" incaslib="Public" quiet;
load data=work.infographic outcaslib="Public" casout="INFOGRAPHIC" promote;
run;
In order for us to drive the current value to be used as percentage, I'm going to use a parameter. For illustration purposes, I will drive the value of this parameter using a slider component.
We are now going to use this parameter in a calculated item which determines later whether or not a given icon is highlighted or shown:
This will make creating of display rules in the next step easier.
To render this infographic segment, I'm going to use a Geo Coordinate object. While you could use a standard Scatter Plot as well, it doesn't have the same ability to fine tune display rules. Especially the icon support is very useful in this example.
In order to use a geo map, I'm creating a new geo item using the grid x/y coordinates:
You can now assign this item to the geographical map. Make sure to turn off the geographical map background as we are just using some artificial geographical coordinates for the grid cells.
Given we created multiple grid sizes in the data step, you will now either have to add a filter to select a single grid (column cell_grid) or add a button bar with filter interactions against the geo map. This will make sure, that you only have a single grid rendered at a time.
The final step is now to create a display rule to define which icons and colors to use for each data point in the geographical map:
Geographical maps allow the assignment of icons as well as allow you to upload your own icon images:
Once display rules are in place, you can use the button bar and slider to try out different combination of grid sizes and values:
Hope you enjoyed this short tutorial and able to utilize techniques like these in your next infographic!
Enjoy!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!