BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Doris1
Fluorite | Level 6

Hi All,

 

I am brand new to PROC GMAP. I am using the following tutorial to practice:

http://www2.sas.com/proceedings/sugi29/251-29.pdf

 

I am stuck on example 5 using proc format to generate discrete areas on the map. I copied the provided code and ran in SAS 9.4, but it does not seem to provide colors. Even when I tried to use different colors (like red, green, gray, blue), the whole map has a single color (red). I don't know if I am doing anything wrong or if it is the version of the SAS I am using (9.4).

 

* example 5
* create a format to group observations (counties) based on the population;
proc format;
value pop2000_
5379 - 51134 = '5,379 - 51,134'
51401 - 91070 = '51,401 - 91,070'
93765 - 235469 = '93,765 - 235,469'
280150 - 2465326 = '280,150 - 2,465,326'
;
run;
* 2000 census population, New York State counties;
data nys2000;
input county pop2000 @@;
datalines;
 001 294565 003 49927 005 1332650 007 200536
 009 83955 011 81963 013 139750 015 91070
 017 51401 019 79894 021 63094 023 48599
 025 48055 027 280150 029 950265 031 38851
 033 51134 035 55073 037 60370 039 48195
 041 5379 043 64427 045 111738 047 2465326
 049 26944 051 64328 053 69441 055 735343
 057 49708 059 1334544 061 1537195 063 219846
 065 235469 067 458336 069 100224 071 341367
 073 44171 075 122377 077 61676 079 95745
 081 2229379 083 152538 085 443728 087 286753
 089 111931 091 200635 093 146555 095 31582
 097 19224 099 33342 101 98726 103 1419369
 105 73966 107 51784 109 96501 111 177749
 113 63303 115 61042 117 93765 119 923459
 121 43424 123 24621
;
run;
* fill patterns for the map areas (gray-scale fills);
pattern1 v=s c=grayff;
pattern2 v=s c=grayda;
pattern3 v=s c=grayaa;
pattern4 v=s c=gray68;
proc gmap
data=nys2000
map=nys;
id county;
choro pop2000 / discrete;
format pop2000 pop2000_.;
note ' EXAMPLE #5'
j=l ' NEW YORK STATE'
j=l ' COUNTY POPULATION, 2000';
run;
quit;

I've also tried using the default settings, but it has not resolved the single-color map that SAS keeps generating. I am sure there is an easy solution...

 

I would appreciate your help.

 

Doris

gmap33.pnggmap11.png

1 ACCEPTED SOLUTION

Accepted Solutions
Doris1
Fluorite | Level 6

Never mind! I was able to figure out...

The following code placed before proc gmap helped to yield the right map in a graph window.

goptions reset=all border;

View solution in original post

1 REPLY 1
Doris1
Fluorite | Level 6

Never mind! I was able to figure out...

The following code placed before proc gmap helped to yield the right map in a graph window.

goptions reset=all border;

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
  • 2198 views
  • 2 likes
  • 1 in conversation