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

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

2 REPLIES 2
ballardw
Super User

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.

bspangler
Calcite | Level 5

Thanks, that worked perfect!

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1751 views
  • 0 likes
  • 2 in conversation