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

I am trying to create a colored map of counties using proc gmap. However, I am not able to get the colors using the following code (all counties are pale green). Please advise.  


proc format;
value pop2016f
3972 - 50083 = '3972 - 50083'
50084 - 85881 = '50,083 - 85,881'
85882 - 234011 = '85,882 - 234,011'
234012 - 2606852 = '234,012 - 2,606,852'
;
run;


goptions cback=white border htitle=12pt htext=8pt;

pattern1 value=msolid color=vpag; /* abbreviation for very pale green */
pattern2 value=msolid color=vpab; /* abbreviation for very pale blue */
pattern3 value=msolid color=pink;
pattern4 value=msolid color=yellow;

 

proc gmap data=data_for_map map=MD all;
id county;
choro pop2016 / discrete anno=anno levels=4 coutline=black ;
format pop2016 pop2016f.;
run;
quit;

1 ACCEPTED SOLUTION

Accepted Solutions
monali
Obsidian | Level 7

Thanks. It works by adding "missing" option The formats seem to be working. I will double-check if the chart numbers are correct. 

I got the following warning with the previous code: 

 

WARNING: Some observations were discarded when charting Total_Population_N (from Census. Only first matching observation was used. Use STATISTIC= option for summary statistics.

 

View solution in original post

2 REPLIES 2
ballardw
Super User

@monali wrote:

I am trying to create a colored map of counties using proc gmap. However, I am not able to get the colors using the following code (all counties are pale green). Please advise.  


proc format;
value pop2016f
3972 - 50083 = '3972 - 50083'
50084 - 85881 = '50,083 - 85,881'
85882 - 234011 = '85,882 - 234,011'
234012 - 2606852 = '234,012 - 2,606,852'
;
run;


goptions cback=white border htitle=12pt htext=8pt;

pattern1 value=msolid color=vpag; /* abbreviation for very pale green */
pattern2 value=msolid color=vpab; /* abbreviation for very pale blue */
pattern3 value=msolid color=pink;
pattern4 value=msolid color=yellow;

 

proc gmap data=data_for_map map=MD all;
id county;
choro pop2016 / discrete anno=anno levels=4 coutline=black ;
format pop2016 pop2016f.;
run;
quit;


If all of your colors are pale green then I would double check the range of values of your pop2016 variable in the data_for_map data set as the first step.

 

Are there any notes in the log?

monali
Obsidian | Level 7

Thanks. It works by adding "missing" option The formats seem to be working. I will double-check if the chart numbers are correct. 

I got the following warning with the previous code: 

 

WARNING: Some observations were discarded when charting Total_Population_N (from Census. Only first matching observation was used. Use STATISTIC= option for summary statistics.

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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