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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1389 views
  • 0 likes
  • 2 in conversation