Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
art297
Opal | Level 21

Given the following data, how would one create daily prism maps that show the cummulative number of thefts that have occurred in each state?

pattern1 c=cxb70000;

pattern2 c=cxc71585;

pattern3 c=cxeeff3a;

data thefts;

  informat theftdate date9.;

  input theftdate state  thefts;

  cards;

20jun2013 17 50

20jun2013 18  0

20jun2013 19 10

21jun2013 17 60

21jun2013 18 10

21jun2013 19 70

;

The states are fips codes, the thefts variable already represents the cummulative number of thefts, and the basic set of maps that I want to create are similar to:

proc gmap map=maps.us data=thefts (where=(TheftDate eq '20jun2013'd));

   id state;

   prism thefts / coutline=black discrete nolegend;

run;

quit;

But .. I want to control the color of each state and I want each state's height to be the thefts' number on a scale from 0 to 5000.

Can that be done and, if so, how?

TIA,

Art

2 REPLIES 2
GraphGuy
Meteorite | Level 14

You can control the color of the land, and the height (and color) of the bars separately with a block map, but I don't think that's possible with a prism map (in a prism map, the height & color of the land would both be tied to 1 variable, I believe).

art297
Opal | Level 21

: I had cross-posted this to SAS-L and Joe Matise and Nat Wooding got me sufficiently close to what I am trying to do.  It doesn't meet my specs 100%, but definitely comes close enough for my current need.

To keep the height standard across graphs I created a dummy fips code and assigned the maximum value to it.

I set the colors with pattern statements and then used area=state to assign the patterns.

Finally, I included a relzero option to have states with no data show zero frequencies.

i.e.,

data usmap;
  set maps.us end=eof;
  output;
  if eof then do;
  state=99;
  statecode="un";
  segment=1;
  x=.0950000000;
  y=.1600000000;
  output;
  segment=2;
  x=.0949999999;
  y=.1599999999;
  output;
  end;
run;


pattern1 c=cxb70000;
pattern2 c=cxc71585;
pattern3 c=cxeeff3a;

proc gmap map=usmap data=theftsovertime (where=(TheftDate eq '01FEB2010'd));
  id state;
  prism thefts / coutline=black levels=all nolegend area=state relzero;
run;
quit;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1165 views
  • 0 likes
  • 2 in conversation