BookmarkSubscribeRSS Feed
sascode
Quartz | Level 8

Hello ,

attached are two datasets, first one(Baltimore city) contains longitude and latitude for a city in Baltimore, and in second  one are few data points with location information which i need to place on map and color by tower Cell.
I am able to do it in R but not in SAS.

Thank you.

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Many of us will not download Excel files as they are security threats. The best way to provide data is via SAS data step code (and not in any other format). Instructions

 

But also, show us what you have tried. Have you looked at the PROC SGMAP documentation?

--
Paige Miller
Ksharp
Super User

Calling @Rick_SAS  and @GraphGuy 

Rick_SAS
SAS Super FREQ

As others have suggested, start with the doc. Here is an example that overlays points and lines on a map:

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grmapref/n0x9p71lic5q5an15063k0qjo8er.htm

 

You should also look at the dozens of examples in the SAS blogs. For example, Google quickly located this one:

https://blogs.sas.com/content/sastraining/2017/03/29/plotting-markers-on-a-map-at-zip-code-locations...

 

sascode
Quartz | Level 8
Thank you for your suggestions.
Much appreciated it.
GraphGuy
Meteorite | Level 14

As PaigeMiller mentioned, it would be interesting to see what you've tried.

 

That being said, here is one solution ...

 

proc import datafile="/home/u59782200/datapoints.xlsx" out=datapoints dbms=xlsx;
run;

proc import datafile="/home/u59782200/balt_city.xlsx" out=balt_city dbms=xlsx;
run;

proc sgmap mapdata=balt_city plotdata=datapoints;
openstreetmap;
choromap / mapid=subregion lineattrs=(color=red thickness=2px);
scatter x=long y=lat / group=tower 
 markerattrs=(symbol=circlefilled size=12px) 
 /* More current versions let you specify colors via colormodel=(cxd7191c yellow) */
 ;
run;

baltimore_towers.png

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 437 views
  • 2 likes
  • 5 in conversation