Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
Kaushansky
Obsidian | Level 7
I have a crime lat and Long file and would love to map the crime stats at the street level? What is the best approach?
7 REPLIES 7
Kaushansky
Obsidian | Level 7
Hi there.
I’m using desktop SAS 9.4 and have SAS Studio 3.8

AhmedAl_Attar
Ammonite | Level 13

@Kaushansky 


@Kaushansky wrote:
Hi there.
I’m using desktop SAS 9.4 and have SAS Studio 3.8

Hmm, to my knowledge, in this case you are limited to SAS/GIS (if licensed) and maybe Proc Geocode!?

 

Quentin
Super User

There is an article on reverse geocoding here:

https://communities.sas.com/t5/SAS-Communities-Library/Reverse-Geocoding-Using-PROC-GINSIDE/ta-p/895...

 

I would think that would be good for, say, mapping lat and long to state level, or county level, because a polygon can represent a state or county.   Not sure how well it would work for mapping to a street.

 

I guess another option would be to use a google maps API or similar to do the lookups.

 

I also stumbled across this solution, which uses an R package to reverse geocode, and looks like it will look up street addresses.  https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-do-reverse-geocoding-in-SAS/td-p/342193

The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
Kaushansky
Obsidian | Level 7

Thanks but that did not work. Here is the dataset I have (attached). In terms of SAS I have Proc Map and Proc GIS loaded.

 

What is the best way top map by zipcode?

Quentin
Super User

If you go to lexjansen.com index of user group papers, there are lots of papers about mapping by zipcode:

https://www.lexjansen.com/search/searchresults.php?q=map+zipcode

 

This isn't something I do, so can't recommend a specific approach.

The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
GraphGuy
Meteorite | Level 14

Someone mentioned SAS/GIS - that would probably be the best SAS solution for this type of thing ... but it was never finished, and the current version of the software has been 'frozen' (no new decelopment) for many years, and it would be difficult to find expertise/advice/examples to help you with that.

 

You could plot lat/long crime data on streetmaps using SAS/Graph Proc Gmap, but it's a bit cumbersome (you have to download all the map tiles, and stitch them together, and then get a bit tricky to annotate your data onto the map tile images).

 

SAS Proc SGmap makes overlaying lat/long data onto streetmaps very simple - that's what I would recommend. I put an example in a blog that might get you started (sample code at bottom of the blog): https://blogs.sas.com/content/graphicallyspeaking/2021/08/17/cary-nc-data-fire-incidents/

 

cary_fire.png

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 7 replies
  • 2332 views
  • 4 likes
  • 4 in conversation