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-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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