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.
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
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.
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';
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: