In the last blog post, we wrote about the new features in WPS Analytics v4. I wanted to spend some time on one procedure that is new to this release and that is GMAP. GMAP allows you to create thematic maps (also known as chloropleth maps) to visually display your data among boundaries such as state, county and other political areas.
I became quite excited when I found out that mapping was going to be made available in this release. To accompany GMAP, WPS Analytics also includes a few complimentary procedures such as GREDUCE and GREMOVE. PROC GREDUCE allows you to create a lower resolution map and PROC GREMOVE provides a way for you to combine areas into larger regions.
One procedure that is missing at the moment is PROC GPROJECT. In the map below of U.S. Census Regions, you can see the output using unprojected coordinates. It may be possible to use PROC Python to project a map coordinate file to something like an Albers projection. Python has a lot of mapping routines and I wouldn’t be surprised if some developer(s) have created software to change projections.
Here is the relatively simple code for creating the map above.
if (state > ’56’) or
(state in ( ’02’, ’15’,’07’, ’14’, ’43’, ’52’)) then delete ;
if state = ’15’ or state=’02’ then delete;
label regiontext = ‘Region’;
if region=1 then regiontext=‘East ‘;
if region=2 then regiontext=‘South ‘;
if region=3 then regiontext=‘Midwest’;
if region=4 then regiontext=‘West ‘;
pattern1 v=ms c=lightBlue; pattern2 v=ms c=Red;
pattern3 v=ms c=Yellow; pattern4 v=ms c=orange;
proc gmap data = regions map=states48;
id state ;
choro regiontext / discrete;
Title HEIGHT= .25in ‘U.S. Census Regions’;
You can also create maps at the county level. Below is another simple map that highlights the counties that are in the State of Ohio and make up the Cleveland, Columbus or Cincinnati metropolitan areas. The counties that are not part of these three MSA’s is shaded light gray.
The code that I used to create the Ohio Counties map is below.
if geoid in(‘39041’,‘39045’,‘39049’,‘39089’,‘39097’,‘39117’,‘39129’,‘39159’)
then MSA=‘Columbus ‘;
if geoid in(‘39015’,‘39017’,‘39025’,‘39061’,‘39165’)
if geoid in(‘39035’,‘39055’,‘39085’,‘39093’,‘39103’)
then MSA=‘Cleveland ‘;
keep state county msa geoid segment;
*–> Create the map for the state of Ohio and define the three major MSAs;
pattern4 v=ms c=lightgray;
pattern2 v=ms c=Red;
pattern3 v=ms c=lightblue;
pattern1 v=ms c=yellow;
proc gmap data = oh(where=(segment < 5)) map=ohcnty;
where state = ’39’;
id state county ;
choro msa / discrete;
Title1 HEIGHT= .25in “Ohio Counties Part of the State’s Largest MSA’s”;
Title2 “Cleveland, Columbus, Cincinnati MSA”;
Footnote1 HEIGHT=16pt BOLD J=Center font=Arial ” “;
footnote2 ” “; Footnote3 ” “;
Footnote4 HEIGHT=10pt J=left ‘Created by MineQuest Business Analytics’ J=Right font=Arial ‘PROC GMAP using WPS Analytics v4.0’;
Footnote5 HEIGHT=10pt J=left ‘Authorized Reseller of WPS’ J=Right font=Arial “March 28, 2018 “;
With PROC GMAP and congressional district mapping data sets, you can even plot the congressional districts in a state depicting which districts are controlled by the Republicans and which are controlled by the Democrats.
Below is another WPS Analytics generated map that shows which of the nine congressional districts are held by each party.
As shipped, WPS Analytics v4.0 only contains map files for France. MineQuest has created a set of map files for the U.S. State and County outlines. These data sets were used in the creation of the two maps in this blog post.
If you licensed your WPS software from MineQuest, World Programming or other resellers, send us an email at firstname.lastname@example.org and request the map coordinate files used above. We ask that you provide contact information (Name, Company, Title, Address and Email) so we can send you brochures and updates about our services and products.
Finally, it’s worth pointing out what a great value WPS Analytics is compared to our competition. WPS continues to be added on to, fleshed out, enhanced, or whatever description you want to throw out. The product is an amazing offering with so many procedures and database engines included in the annual license fee.
Speaking of license fees, WPS Analytics is about 10% the cost of our competitors first year fees and about one-third the cost of their renewal price.
About the author: Phil Rack is President of MineQuest Business Analytics, LLC located in beautiful Tucson, Arizona. Phil has been a SAS language developer for more than 25 years. MineQuest provides WPS consulting and contract programming services and is an authorized reseller of WPS in North America.