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

Anyone knows if there is a local solution to replace "ESRIMAP" step in the code below? I searched how to map on SAS, but my data platform doesn't allow me use any internet. So this example leads to a picture with gradient only but no map.

proc sgmap mapdata=states
  maprespdata=sashelp.us_data
  plotdata=plot_data;
  esrimap
  url='https://services.arcgisonline.com/arcgis/rest/services/Canvas/
World_Light_Gray_Base/MapServer';
  choromap population_2020 / mapid=state density=2
    name='choro';
  text x=long y=lat text=statename /
    textattrs=(size=6pt);
  gradlegend 'choro' / title='2020 Population' 
	   extractscale;
run;
ods graphics / reset;
title;

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
quickbluefish
Barite | Level 11

If you can't use ESRI, you would need to somehow upload a shapefile (in this case, a US state shapefile) to whatever the location is where your data are.  I don't think base SAS has any 'built-in' shapefiles in sashelp, but I could be wrong.  

 

Generally, these files are actually a set of files (.shp, .shx, etc.) - you'd upload them all to one folder, then use PROC MAPIMPORT to convert these into a SAS dataset (by pointing it at the .shp file).   There are various other procedures you can use to manipulate that file afterwards (GREDUCE, GRPOJECT, etc.) depending on your needs, after which you'd use SGMAP or GMAP to create the map (along with your dataset that contains the values to be plotted).  

View solution in original post

1 REPLY 1
quickbluefish
Barite | Level 11

If you can't use ESRI, you would need to somehow upload a shapefile (in this case, a US state shapefile) to whatever the location is where your data are.  I don't think base SAS has any 'built-in' shapefiles in sashelp, but I could be wrong.  

 

Generally, these files are actually a set of files (.shp, .shx, etc.) - you'd upload them all to one folder, then use PROC MAPIMPORT to convert these into a SAS dataset (by pointing it at the .shp file).   There are various other procedures you can use to manipulate that file afterwards (GREDUCE, GRPOJECT, etc.) depending on your needs, after which you'd use SGMAP or GMAP to create the map (along with your dataset that contains the values to be plotted).  

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
  • 131 views
  • 1 like
  • 2 in conversation