BookmarkSubscribeRSS Feed
chelepi
Calcite | Level 5
Hello,
I am trying to create maps with proc sgmap and am having trouble finding a suitable basemap using the esrimap statement. I have successfully loaded various basemaps, but I'm trying to find something more like the Esri Human Geography map (https://www.arcgis.com/home/item.html?id=3582b744bba84668b52a16b0b6942544). In my provided example, the Light Gray Base map doesn't have enough labels and the Light Gray Reference doesn't have enough features. I'm trying to find something that combines the two, but I'm not sure which specific esri basemaps are attainable via sgmap. Thanks in advance for any input. 
 
chelepi_0-1738027431317.pngchelepi_1-1738027446804.png

 

 

Data sample_coords; 
input lat long ;
Datalines ; 
33.941270 -118.403977
34.121079 -118.300805
;
run; 

/*World Light Gray Base*/
proc sgmap 
plotdata=sample_coords
NOAUTOLEGEND ;
esrimap
      url='https://services.arcgisonline.com/ArcGIS/rest/services/canvas/World_Light_Gray_Base';
scatter x=long y=lat / markerattrs=(symbol=trianglefilled size=8 color=red)
;
title "World Light Gray Base"; 
run; 

/*World Light Gray Reference*/
proc sgmap 
plotdata=sample_coords
NOAUTOLEGEND ;
esrimap
      url='https://services.arcgisonline.com/ArcGIS/rest/services/canvas/World_Light_Gray_Reference';
scatter x=long y=lat/ markerattrs=(symbol=trianglefilled size=10 color=red) 
;
title "World Light Gray Reference"; 
run; 

1 REPLY 1
quickbluefish
Barite | Level 11

The Base SAS procedures SGMAP and GMAP aren't really for true GIS maps with layers - rather, they create cartographic maps over which you can layer things like a SCATTER plot, etc.  As far as I know, to do what you're trying to do with Base SAS, you would need to find or create a dataset with the lat/long coordinates of all the cities, etc., of interest that you want to show as features (literally just a SAS dataset with columns, CITY, LAT, LONG), then use the SCATTER statement to overlay those on top of the ESRIMAP statement that you use to create the base map (in the same way that you're currently overlaying triangles).  The SCATTER statement provides an option to specify a variable name (in your case, CITY) with which to label the various X,Y coordinates.  This can definitely be tricky.  I have found that GMAP can do some things that SGMAP can't and vice versa.  Overall, I'd say that you can create pretty decent looking maps with Base SAS (as opposed to the separate package, SAS/GIS), but the process can be pretty tricky and involve a fair amount of trial and error, esp. if you need to deal with projections.  Good luck.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1 reply
  • 258 views
  • 0 likes
  • 2 in conversation