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;
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.
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.
Ready to level-up your skills? Choose your own adventure.