Data visualization with SAS programming

SAS Code Request - U.S. State Map That Maps A Company's "Footprint" And Compares A New Product Usage By Customer

New Contributor
Posts: 2

SAS Code Request - U.S. State Map That Maps A Company's "Footprint" And Compares A New Product Usage By Customer

The Company has a footprint/presence mostly in the southern part of the United States.  I have the brick and mortar locations at the street address, city, state and zip code level in a dataset.  There are also some "outlier" locations in parts of the northern United States (I would like to have these separated from the rest of the footprint at the city location level) 

The Company has just implemented a new product/campaign and I have the customers utilizing that product at a city and state and zip code level (and if in the footprint by state and city).  The product has associated with it a sports team logo that the customer can select. 

I would like to track/map the Company's footprint as the "backdrop" image with the customer location and team selection location overlaid.

As it is a new product, the map detail could be based upon city but as the usage grows I think I would have to migrate to state information.  Thus, I would need annotations for the number of brick and mortar locations for each state (or via a legend) and then a customer count for each state with a detail of team selection count.  But, I am open to ideas and suggestions.  So far, looking at the raw data, I have found it interesting that a customer in Louisiana would pick a team in Ohio for instance. The map might also indicate by team its fan/following by count or percent (or it may have to a secondary map visualization.

My end goal is to show to marketing/management (if it exists) trends on customer purchase behavior and where there could be a justification for new targeting strategies at a location x outside of the Company footprint.

I am a user of SAS Enterprise Guide but am not a "programmer/coder" but rather use query builder.  I have scoured the SAS websites for examples and ideas but have found few that are able to generate a visual map when brought into the EG environment, let alone when I try to amend it with the Company's data.  I am also at a loss as to how I "export" the resulting map with the annotation capabilities to a sharepoint site, website (intercompany google site for instance) etc.

I have found several maps from the SAS sites that have "animation" capabilities as well - like the tornado activity over x period of years.  Once I found that I thought it would be an idea to also create a multitude of similar maps over time to show management/marketing how the product purchases have increased (hopefully) and where that purchasing has occurred.

Any assistance or answers would be greatly appreciated.

SAS Employee
Posts: 963

Re: SAS Code Request - U.S. State Map That Maps A Company's "Footprint" And Compares A New Product Usage By Customer

Glad to hear you're interested in using SAS to map your data!

If you're going to take address-based data and plot it on a map, you'll want to use Proc Geocode to estimate latitude/longitude for the addresses (either street-level addresses, zipcode-centroid, or city centroid ... depending on how much detail you want to show).

You can plot markets at those lat/long locations using annotate (after using Proc Gproject on the map and the lat/long markers). These markers could represent your stores, your customers, or other things.

Enterprise Guide only provides an interface to basic Proc Gmap mapping, and does not include customizing maps with annotated markers. Therefore this is something that you will have to write code to accomplish. The most similar example I have to what you're wanting might be this map showing the BoJangles locations:  (sas code)

But I think it might be better for you to start from scratch. This chapter in my new (free!) eBook should be very helpful:

New Contributor
Posts: 2

Re: SAS Code Request - U.S. State Map That Maps A Company's "Footprint" And Compares A New Product Usage By Customer

Robert -

Thank you for the comments and suggestions.  I will work on it and hopefully succeed at the task.

If I might ask you some more specific questions on some graphs that you have developed and are in your book:

1) I took this map of Poland you had with select cities and "replaced" it with US and some cities.  But, I was unsure what map name to replace it with.  I found the various map datasets in SAS but the one for Poland had "ID" with "Lakes" and the ones I found with "ID" for US did not have the required geolocation data (as I recall latitude, longitude, X, Y).  And, the code at the end references that "ID"  It appears that I have EG 4,3

2) I also took the nuclear plant graph as I think this type may get me to the farthest point that I need.  I replaced the state shading with my own data and had to create/add new shades and groupings.  But, the resulting map still only displayed the 4 categories that you had.  Is that because the "legend" is programmed only to be x length and width?

3) Is it possible to "overlay" maps with a SAS program?  For instance as mentioned, with the tornado activity map that you created over X years - could those be overlaid instead?  If that is a possibility then I could create one map of the customer data and another map with the footprint data etc.

4) Would you be able to address/answer how these resulting maps with the annotations can be transferred to a sharepoint site or browser (Chrome) via a link or something?  How do others within the organization view the result if they are not SAS users?

Thank you in advance.

SAS Employee
Posts: 170

Re: SAS Code Request - U.S. State Map That Maps A Company's "Footprint" And Compares A New Product Usage By Customer

1.  It would better if you used MAPSGFK rather than MAPSSAS (MAPS).  MAPSGFK is consistent where MAPSSAS was not.  You can reassign MAPS to be either MAPSSAS (default) or MAPSGFK.  MAPSSAS will soon be replaced and hasn't been updated.  MAPSGFK is updated by a 3rd party.  For more info, see: and the paper Tips and Tricks: Using the new SAS Map data sets

Post a Question
Discussion Stats
  • 3 replies
  • 3 in conversation