BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASGeek
Obsidian | Level 7

Hello,

I was tasked with an interesting request. My manager asked me to use SAS to plot the locations of our stores compared to the locations of another competitor, showing both locations. For example, we have 2 stores in LA and they have 3. He wants to see this across the entire North American continent (Canada, US, Mexico)

 

My questions are:

1. What would be the best way to show that (he wants a map)

2. How?

 

If anyone has results/suggestions and code they would share, I would be very grateful.

 

Thank you

 

Paula

 

1 ACCEPTED SOLUTION
4 REPLIES 4
ballardw
Super User

One example of placing City on a map at https://support.sas.com/kb/25/499.html

What I would do is provide two markers if both companies have a presence and the Number of stores. There is a Position adjustment available with annotation to make minor differences from a given coordinate pair. I would use consistently different Positions such as 1 form my company, which would place the marker/text at the upper left of the coordinate and 9 for the other company which would place their marker at the bottom right of a coordinate pair.

 

The tricky part is getting a map data set and annotate coordinates in the same units.

GraphGuy
Meteorite | Level 14

First, find the latitude/longitude of the stores (you could use Proc Geocode, or some other technique).

 

You can then easily overlay markers on a map at those lat/long coordinates using Proc SGmap. You could use different colors or shapes for the 2 companies. If you run into the situation where they're in essentially the same location (depending on how far the map is zoomed out ... 20 miles might look about the same on a US map, for example) then be sure to use markers that will still be visible when overlapping, or use transparent colors that will 'mix' well to tell you there's an overlap.

 

Here's a simple example, showing how to overlay colored markers at lat/long coordinates using SGmap (I use city locations from mapsgfk.uscity to get the lat/longs, but I would recommend using something like Proc Geocode to get street-level lat/long coordinates of the stores):

 

http://robslink.com/SAS/ods6/colored_dot_map_info.htm

 

colored_dot_map1.png

SASGeek
Obsidian | Level 7

 Thanks all for your great help. Now it's up to me!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 696 views
  • 1 like
  • 3 in conversation