I have a dataset like this (truncated for this post):
data want; input State $2. Setout_Code $3. Count_of_Code 3.; datalines; AR AB 14 AR BR 1 AR BT 10 AR DG 1 AR HB 1 AR KR 4 AR TB 1 AR TL 3 AR TR 1 AZ AB 6 AZ BR 2 AZ BT 19 AZ HB 1 AZ KR 2 AZ TL 5 AZ WP 5 CA AB 5 CA BG 2 CA BR 2 ; run;
In a separate program, Tableau, I've been able to project these values onto a map like such:
I'm trying to recreate this map in a smiliar manner in SAS, but cannot figure out how. This is as close as I'm getting:
The code i'm using to generate this in SAS is:
proc gmap data=work.want map=maps.us (where=(statecode not in ('PR' 'AK' 'HI'))); id STATE Setout_Code; area STATE / nolegend; block Setout_Code; run;
Can someone help or point me in the direction of a method/options/different proc that will get me closer to generating a map like Tableau? In the future, there might be need for also mapping out cities where these 'Setout_Code' counts are occurring, and I would potentially like to map those out on the same sort of US map of states (but specific to the city with each setout code colored separately).
Again, note that for this post's sake the data has been truncated, so both maps are showing the additional data I have in SAS.
Note that I've moved this post to the graphics forum.
Here's a recent blog post to get you started, but there are also more shown lately on the blogs so I'd read through there first as a starting point 🙂
I am trying to understand the connection between the Tableau map and the SAS map. In Tableau you apparently have one value, or summarization per state applied at a single location to set the radius of a dot. In SAS you have, at least in some areas, multiple points with a block for each but I am not sure what the block represents or how it is placed as you aren't showing anything that I recognize that should make multple blocks per state.
If you are attempting to do something closer to the Tableau appearance then you likely want something with most of the information displayed with an annotate data set.
You may want to visit this page and see if something is close to what you want.
The tableau output is just an example of what I'm hoping to achieve in SAS. Of all the SAS forums/pages/blogs/info (like the one you linked to) I cannot for the life of me figure out how to try to apply my SAS dataset and code, and use 'anno' or 'annotate' to overlay data onto a map.
Is there a good starting point for anno/annotate and how that works with graphs? I was turning myself in circles when i tried searching for that from a 'beginners' POV.
The key bits with an annotate approach is 1) getting your locations specified IN THE SAME coordinate system as the map data set you will use and then creating a data set that attaches text, color, symbol what have you at those locations. Then setting the appropriate base map options and display.
The classic starter example is at: https://v8doc.sas.com/sashtml/gref/z0n01-ex.htm which places a symbol at the location of three cities on a US map.
Note that there are a number of macro statements, look up %annomac in your online help, to make repetive statments, like setting color and size based on values in your data set, easier.
It may be worth wondering around on http://robslink.com/SAS/ as there are many examples. The main pages show a number of graphs and clicking on title or picture takes you to a choice of code or the result. These are a good place to look for similar graphs as he provides data and some documentation.
Note that if you are attempting to do drilldowns that is possible but adds a lot of complexity.
This chapter might help you ...
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.