BookmarkSubscribeRSS Feed
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.

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


ABC => pattern1=blue

ABE => pattern2=green



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.

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;

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

proc gmap data=foo1;
id statecode;
choro value / midpoints='ABC' 'PQR';

proc gmap data=foo2;
id statecode;
choro value / midpoints='ABC' 'PQR';



Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


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