Sample 62359: Place marker and city name at select state capital locations
The sample code on the Full Code tab uses the SGMAP procedure to add markers and text on a map at select capital city locations.
You must be using the fifth maintenance release of SAS® 9.4 (TS1M5) on 64-bit Windows or 64-bit Linux operating systems in order to run this sample. This sample requires the SAS/GRAPH® map data sets to be installed.
Be aware that the CHOROMAP statement used in this sample is pre-production in SAS 9.4 TS1M5.
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 SAS 9.4 TS1M5 SGMAP procedure to add markers and text on a map at select capital city locations.
You must be using the fifth maintenance release of SAS® 9.4 (TS1M5) on 64-bit Windows or 64-bit Linux operating systems in order to run this sample. This sample requires the SAS/GRAPH® map data sets to be installed.
Be aware that the CHOROMAP statement used in this sample is pre-production in SAS 9.4 TS1M5.
data capitals;
set mapsgfk.uscity;
/* Select the state capital cities in South Carolina, North Carolina, and Virginia */
where state in(45 37 51) and capital='Y';
keep city long lat;
run;
/* Create a subset map data set for South Carolina, North Carolina, and Virginia */
data states(rename=(long=x lat=y));
set mapsgfk.us_states(drop=x y );
where state in(45 37 51);
run;
title 'Selected State Capitals';
/* Reference the map data set in the MAPDATA= option
Reference the city data set in the PLOTDATA= option */
proc sgmap mapdata=states plotdata=capitals;
/* Create the map outline */
choromap / mapid=id;
/* Place a filled star symbol at the location of the LONG and LAT
variables in the PLOTDATA= data set */
scatter x=long y=lat / markerattrs=(symbol=starfilled color=depk size=10px);
/* Place the city name above the city location */
text x=long y=lat text=city / textattrs=(color=gray size=10pt) position=bottom;
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:26 |
Date Created: | 2018-05-22 15:02:56 |
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 | |