Data visualization with SAS programming

Changing Color of Area and Blocks

Reply
Occasional Contributor
Posts: 7

Changing Color of Area and Blocks

I'm working on a map which I'm trying to summarize the Total US with two variables, Volume and Share. Below is the SAS code I'm using to create the map. My issue is no matter what I try I can't change the purple color of the states themselves. Any advice?

GOPTIONS RESET=ALL;

LEGEND1 Label=("% Volume Change");

LEGEND2 Label=("State Share");

PATTERN1 VALUE=SOLID COLOR=RED;

PATTERN2 VALUE=SOLID COLOR=ORANGE;

PATTERN3 VALUE=SOLID COLOR=YELLOW;

PATTERN4 VALUE=SOLID COLOR=GREEN;

Proc GMAP Map=MAPS.US Data=Step_3;

  Format Volume GRPFMT. Share SHRFMT.;

  ID StateCode;

  Block VOLUME / LEGEND = LEGEND1 LEVELS = 4 CBLOCK=BLACK SHAPE=C ;

  Area SHARE / LEGEND = LEGEND2;

Run; Quit;

SAS Graph.png

SAS Employee
Posts: 963

Re: Changing Color of Area and Blocks

Here is one way to do it...

data my_map; set maps.us;

original_order=_n_;

run;

proc sql;

create table my_map as

select unique my_map.*, us_data.region

from my_map left join sashelp.us_data

on my_map.statecode=us_data.statecode

order by original_order;

quit; run;

/* colors for 3 'levels' (bar colors) */

pattern1 v=solid c=pink;

pattern2 v=solid c=yellow;

pattern3 v=solid c=red;

/* colors for the regions (map land area colors) */

pattern4 v=msolid c=purple;

pattern5 v=msolid c=brown;

pattern6 v=msolid c=gray;

pattern7 v=msolid c=cx00ff00;

proc gmap data=sashelp.us_data map=my_map;

id region statecode;

block population_2010 / levels=3 area=1;

run;

blockmap.png

Occasional Contributor
Posts: 7

Re: Changing Color of Area and Blocks

Thanks.

Post a Question
Discussion Stats
  • 2 replies
  • 345 views
  • 0 likes
  • 2 in conversation