BookmarkSubscribeRSS Feed
nithishsaji94
Calcite | Level 5

I am allocating zipcodes to facilities using a proc optmodel. After it is done, I am comparing initial and final maps. How can I make the legends the same color if the proc optmodel is removing some facilities ?

 

My response data looks like [zip,facility] , eg [12345, ABC].[456789,PQR] and model might tell me [12345,ABC],[456789,ABC] thus shutting down PQR facility.

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

The only way is to manually list the facilities and assign them a colour (one pattern for each), and then use the second list of facilities to assign the remaining ones the same pattern.

For example

ABC => pattern1=blue

ABD => pattern2=red

ABE => pattern3=green

then

ABC => pattern1=blue

ABE => pattern2=green

 

 

ballardw
Super User

Easiest is likely to define a single legend with all of the facilities and use that. Yes, some facilities that are not included will be in the legend. I suggest that having legend items that do not appear in the map may be a way to quickly identify which were removed by the modeling or other processes.

GraphGuy
Meteorite | Level 14

I'm not sure how you'd implement the 2 suggestions provided so far.

 

But here's what I recommend. Use gmap's "midpoints=" option to list all the things you want in the legend (then they'll appear, even if they aren't in the data in that particular map). Here's a short example showing how to use it:

 

data foo1;
statecode='NC'; value='ABC'; output;
statecode='SC'; value='PQR'; output;
run;

data foo2;
statecode='NC'; value='ABC'; output;
statecode='SC'; value='ABC'; output;
run;

proc gmap data=foo1 map=maps.us;
id statecode;
choro value / midpoints='ABC' 'PQR';

proc gmap data=foo2 map=maps.us;
id statecode;
choro value / midpoints='ABC' 'PQR';

map1.pngmap2.png

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 657 views
  • 1 like
  • 4 in conversation