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.

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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