BookmarkSubscribeRSS Feed
AncaTilea
Pyrite | Level 9

Hi,

Can SAS (9.3) PROC GMAP create a US map INCLUDING the Territories?

*FAKE DATA;

DATA DSET;

    INPUT STATECODE $ RATE;

STATE = STFIPS(STATECODE);

DATALINES;

AK     91.2

AL     102.2

AR     115.1

AZ     131.5

CA     138.1

CO     151.5

CT     163.3

DC     178.5

DE     197.0

FL     218.4

GA     237.0

HI     257.4

IA     276.2

ID     287.1

IL     306.4

IN     302.6

KS     321.5

KY     337.5

LA     353.7

MA     363.0

MD     367.5

ME     373.8

MI     373.9

MN     375.0

MO     375.7

MS     378.2

MT     386.0

NC     377.9

ND     374.3

NE     378.4

NH     371.3

NJ     357.1

NM     252.6

NV     271.5

NY     287.5

OH     303.7

OK     313.0

OR     317.5

PA     323.8

PR     323.9

RI     325.0

SC     325.7

SD     328.2

TN     336.0

TX     327.9

UT     324.3

VA     328.4

VT     321.3

WA     307.1

WI     292.8

WV     278.5

WY     264.2

FM     328.4

GU     321.3

MH     307.1

MP     292.8

PW     278.5

PR     264.2

VI     264.2

;

RUN;

    PROC GMAP DATA = DSET MAP = MAPS.US ALL GOUT = WORK.GRAPHS;

    ID STATE;

    CHORO RATE/NAME = "MAP"  DISCRETE COUTLINE = GRAYAA noLEGENDSTATISTIC = MEAN DES = '';

    RUN;QUIT;

1 REPLY 1
GraphGuy
Meteorite | Level 14

You could start with the world map shipped in SAS, and then just select out all the countries/territories you want. Of course, by default they would just be in their proper lat/long location, and you probably want them scooted over closer to the US(?) ... in which case you'd have to determine what x/y offset to apply to each of the territories to place it in a convenient & aesthetic location closer to the US. You might also have to re-size some of them (by multiplying the x/y by some factor before moving it). This is the technique that was used to create the maps.us, with Hawaii & Alaska scooted closer to the US (and Alaska resized smaller to 'fit' better).

Another option would be to find map geometry someone was already created like that, and then use "proc mapimport" to import it into SAS.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 868 views
  • 0 likes
  • 2 in conversation