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.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
  • 2 replies
  • 1406 views
  • 0 likes
  • 2 in conversation