Sample 62261: Add markers at select city locations on an Esri map
The sample code on the Full Code tab uses the SGMAP procedure to add markers on an Esri map at select city locations. The GEOCODE procedure is used to obtain the coordinates for those city locations.
You must be using the fifth maintenance release of SAS® 9.4M5 (TS1M5) on 64-bit Windows or 64-bit Linux operating systems in order to run this sample.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample uses the SGMAP procedure to add markers on an Esri map at the locations of select U.S. cities. The coordinates for the locations are determined by city geocoding with PROC GEOCODE.
You must be using the fifth maintenance release of SAS 9.4M5 on 64-bit Windows or 64-bit Linux operating systems in order to run this sample.
/* Create a sample data set containing the names of select U.S. cities */
data cities;
infile datalines dlm='#';
length city $ 24 state $ 2;
input city state;
datalines;
Irvine # CA
Sacramento # CA
San Diego # CA
Rockville # MD
Cary # NC
Charlotte # NC
Boston # MA
Pittsburgh # PA
Austin # TX
Glastonbury # CT
Minneapolis # MN
Addison # TX
Tallahassee # FL
Bloomington # MN
Houston # TX
New York # NY
Chicago # IL
;
run;
/* Use CITY geocoding with PROC GEOCODE to determine
the coordinates for the cities */
proc geocode data=cities out=city_locations method=city;
run;
/* Use the city_locations data to place a marker on an Esri map */
title 'Location of select U.S. cities';
proc sgmap plotdata=city_locations;
/* Reference the Esri map URL */
/* this URL might need to change as Esri makes changes to their site */
esrimap url="https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer";
scatter x=long y=lat / markerattrs=(color=red size=6px symbol=circlefilled)
legendlabel="Location of select cities";
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.

Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGMAP
|
Date Modified: | 2018-06-01 14:53:39 |
Date Created: | 2018-05-02 16:02:46 |
Operating System and Release Information
SAS System | Base SAS | Linux for x64 | 9.4 TS1M5 | |
Microsoft Windows Server 2008 for x64 | 9.4 TS1M5 | |
Microsoft Windows 8.1 Pro x64 | 9.4 TS1M5 | |
Microsoft Windows 8.1 Enterprise x64 | 9.4 TS1M5 | |
Microsoft Windows 8 Pro x64 | 9.4 TS1M5 | |
Microsoft Windows 8 Enterprise x64 | 9.4 TS1M5 | |
Microsoft® Windows® for x64 | 9.4 TS1M5 | |