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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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