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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 852 views
  • 1 like
  • 4 in conversation