Data visualization with SAS programming

How to select specific ranges for US Map in proc gmap

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

How to select specific ranges for US Map in proc gmap

Hi, I am trying to control the pattern ranges in the US Map graph when using proc gmap.  Currently, I am using the default range, but want to be able to control it.  This is my code.  How can I define the ranges?  For example, if I wanted the ranges to be 0%-9%, 10%-19%, etc...  Thanks!

%let count=percent1;

%let grftitl=Population by State;

proc format;

picture pctpic (round) low-<0 ='009.99%' (prefix='-' mult=10000) 0-high='009.99%' (mult=10000);

run;

titleh=1.6"&grftitl";

goptionsdev=emf gsfname=output1gsfmode=replace;

legend1label=(h=1.4)value=(h=1.4);

procgmap allmap=maps.us data=state_count;

format &count pctpic.;

id state;

choro &count / coutline=black legend=legend1;

*Light blue to dark blue colors;

pattern1v=ms c=cxeff3ff;pattern2 v=msc=cxbdd7e7; pattern3v=ms c=cx6baed6;

pattern4v=ms c=cx2171b5;pattern5 v=msc=CX13478C; pattern6v=ms c=CX090766;

run; quit;


Accepted Solutions
Solution
‎02-03-2014 12:30 PM
Grand Advisor
Posts: 9,748

Re: How to select specific ranges for US Map in proc gmap

Easiest would be to use a custom format that groups your data into the desired range and use the Discrete option on the choro statement;

proc format;

value mypct

0 < 10 = ' 0% - 9%'

10 -< 20 = '10%-19%'

...

;

run;

And the choro statement would look like:

Choro &count / discrete coutline=black legend=legend1;

format &count mypct.;

Midpoints or Levels on the choro statement could also work but I prefer the explicit control of the custom format.

View solution in original post


All Replies
Solution
‎02-03-2014 12:30 PM
Grand Advisor
Posts: 9,748

Re: How to select specific ranges for US Map in proc gmap

Easiest would be to use a custom format that groups your data into the desired range and use the Discrete option on the choro statement;

proc format;

value mypct

0 < 10 = ' 0% - 9%'

10 -< 20 = '10%-19%'

...

;

run;

And the choro statement would look like:

Choro &count / discrete coutline=black legend=legend1;

format &count mypct.;

Midpoints or Levels on the choro statement could also work but I prefer the explicit control of the custom format.

Occasional Contributor
Posts: 7

Re: How to select specific ranges for US Map in proc gmap

Thanks, that worked perfect!

Post a Question
Discussion Stats
  • 2 replies
  • 345 views
  • 0 likes
  • 2 in conversation