<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Subsetting a Annotate data set in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/540194#M17869</link>
    <description>&lt;P&gt;I am using the GMAP procedure to map out specific locations in a state, but would also like to add 4 specific cities to the map as a reference.&amp;nbsp; I have the locations of interest as part of the annotate set, and the cities (from the us_cities data) in the other part.&amp;nbsp; I want stars as the markers for the points of interest and just circles or dots as the markers for the 4 cities.&amp;nbsp; Here is my code.&amp;nbsp; I can only get the points of interest to show on my map.&amp;nbsp; &amp;nbsp;I cannot get the cities two show up at all. I am using 9.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Maine;
   set maps.states;
   if state =stfips("ME");
run;



data CITIES;
input City $1-25;
datalines;
PORTLAND
BANGOR
AUGUSTA
CARIBOU
;
RUN;



proc sql; create table ME_CITIES  as
select a.*, "BBL" as color
from maps.uscity A 
where a.State = stfips("ME") and upper(a.City) in (select trim(b.City) from CITIES b);
quit;

 
proc sql;create table ME_1 as
select a.prop_id, a.prop_name, a.total_unit_cnt, 
case when a.Color = 'R' then 'Red' when a.Color = 'Y' then 'BIOY' when a.Color = 'G' then 'Green' end
 as color,
b.state2kx as state, b.std_st as statecode, b.lat as Y, b.lon as X,
b.lat as lat, b.lon as long,
case when a.Color = 'R' then 'High Risk' when a.Color = 'Y' then 'Medium Risk' when a.Color = 'G' then 'Low Risk' end
as risk_category 
from RISK_LIST a LEFT JOIN raw.PROP_INFO b ON a.PROP_ID = b.property_id;
quit;
&lt;BR /&gt;/*if cities have a unit of altitude, other data will have . */&lt;BR /&gt;
data anno1; set ME_1 ME_CITIES;
length text $25.;
xsys='2'; ysys='2'; hsys='3'; when='a';
x= -x *(atan(1)/45);
y = y* (atan(1)/45);
function = 'label';
if alt = . then style = 'special' ;
else style = 'swissb';
if alt = . then text  = 'M'; 
else text = city; 
color = color ;              
if alt = . then size  = 3;  
else size = 5; 
position = '5';

run;



data combined; set maine anno1;
run;


proc gproject data = COMBINED  
degrees
out  = COMBINED1;
id state;
run;


data MAP ANNO ;    
set COMBINED1;                    
if density = .  then
output ANNO;
else
output MAP;             
run;


ods results off;
ods html  close;                        


goptions  reset=all                     
device=jpeg                  
/*cback=cx004488*/  ;             
pattern1  v=solid c=cxeeeee6 r=50;      
;
;


proc gmap data = map      
map  = map           
anno = Anno ;   
id state;                          
choro state /                        
coutline = cx739436           
des      = "Properties"        
nolegend;                     
run;
quit;

ods listing close; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Mar 2019 20:08:12 GMT</pubDate>
    <dc:creator>RandoDando</dc:creator>
    <dc:date>2019-03-04T20:08:12Z</dc:date>
    <item>
      <title>Subsetting a Annotate data set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/540194#M17869</link>
      <description>&lt;P&gt;I am using the GMAP procedure to map out specific locations in a state, but would also like to add 4 specific cities to the map as a reference.&amp;nbsp; I have the locations of interest as part of the annotate set, and the cities (from the us_cities data) in the other part.&amp;nbsp; I want stars as the markers for the points of interest and just circles or dots as the markers for the 4 cities.&amp;nbsp; Here is my code.&amp;nbsp; I can only get the points of interest to show on my map.&amp;nbsp; &amp;nbsp;I cannot get the cities two show up at all. I am using 9.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Maine;
   set maps.states;
   if state =stfips("ME");
run;



data CITIES;
input City $1-25;
datalines;
PORTLAND
BANGOR
AUGUSTA
CARIBOU
;
RUN;



proc sql; create table ME_CITIES  as
select a.*, "BBL" as color
from maps.uscity A 
where a.State = stfips("ME") and upper(a.City) in (select trim(b.City) from CITIES b);
quit;

 
proc sql;create table ME_1 as
select a.prop_id, a.prop_name, a.total_unit_cnt, 
case when a.Color = 'R' then 'Red' when a.Color = 'Y' then 'BIOY' when a.Color = 'G' then 'Green' end
 as color,
b.state2kx as state, b.std_st as statecode, b.lat as Y, b.lon as X,
b.lat as lat, b.lon as long,
case when a.Color = 'R' then 'High Risk' when a.Color = 'Y' then 'Medium Risk' when a.Color = 'G' then 'Low Risk' end
as risk_category 
from RISK_LIST a LEFT JOIN raw.PROP_INFO b ON a.PROP_ID = b.property_id;
quit;
&lt;BR /&gt;/*if cities have a unit of altitude, other data will have . */&lt;BR /&gt;
data anno1; set ME_1 ME_CITIES;
length text $25.;
xsys='2'; ysys='2'; hsys='3'; when='a';
x= -x *(atan(1)/45);
y = y* (atan(1)/45);
function = 'label';
if alt = . then style = 'special' ;
else style = 'swissb';
if alt = . then text  = 'M'; 
else text = city; 
color = color ;              
if alt = . then size  = 3;  
else size = 5; 
position = '5';

run;



data combined; set maine anno1;
run;


proc gproject data = COMBINED  
degrees
out  = COMBINED1;
id state;
run;


data MAP ANNO ;    
set COMBINED1;                    
if density = .  then
output ANNO;
else
output MAP;             
run;


ods results off;
ods html  close;                        


goptions  reset=all                     
device=jpeg                  
/*cback=cx004488*/  ;             
pattern1  v=solid c=cxeeeee6 r=50;      
;
;


proc gmap data = map      
map  = map           
anno = Anno ;   
id state;                          
choro state /                        
coutline = cx739436           
des      = "Properties"        
nolegend;                     
run;
quit;

ods listing close; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Mar 2019 20:08:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/540194#M17869</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2019-03-04T20:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting a Annotate data set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/541392#M17872</link>
      <description>&lt;P&gt;Here's how I would recommend doing it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let name=map;
filename odsout '.';

goptions device=png;
goptions noborder;
 
ODS LISTING CLOSE;
ODS HTML path=odsout body="&amp;amp;name..htm" style=htmlblue;

goptions gunit=pct htitle=6 ftitle="albany amt/bold" htext=4.25 ftext="albany amt/bold";
goptions ctext=gray33;

data readings;
input value lat long;
datalines;
200 45.2998937 -69.283683
250 44.8327587 -70.5181767
225 44.7882013 -67.6611867
;
run;

data cities;
input city $1-25;
statecode="ME";
datalines;
PORTLAND
BANGOR
AUGUSTA
CARIBOU
;
run;

/* merge in the lat/long for each city */
proc sql;
create table cities as
select cities.*, uscity.lat, uscity.long
from cities left join mapsgfk.uscity
on upcase(cities.city)=upcase(uscity.city) and cities.statecode=uscity.statecode;
quit; run;

/* get the map, and project it, and save the projection parameters */
data maine_map; set mapsgfk.us_states (where=(statecode="ME"));
run;
proc gproject data=maine_map out=maine_map latlong eastlong degrees
 parmout=projparm;
id statecode;
run;

/* project the city lat/long's, using the same projection parameters */
proc gproject data=cities out=cities latlong eastlong degrees
 parmin=projparm parmentry=maine_map;
id;
run;

data anno_cities; set cities;
length function $8 color $12 style $35;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='pie'; rotate=360; size=1.5; style='psolid'; color='red';
run;

/* project the city lat/long's, using the same projection parameters */
proc gproject data=readings out=readings latlong eastlong degrees
 parmin=projparm parmentry=maine_map;
id;
run;

data anno_readings; set readings;
length function $8 color $12 style $35;
xsys='2'; ysys='2'; hsys='3'; when='a';
function='label'; position='5';
size=5.0; color='dodgerblue';
style='marker'; text='V'; /* 'star' from sas/graph marker software font */
run;

/* combine the annotate datasets */
data anno_all; set anno_cities anno_readings;
run;


pattern1 v=s c=cxeeeee6;

proc gmap data=maine_map map=maine_map anno=anno_all;
id statecode;
choro statecode / nolegend coutline=cx739436
 des='Properties' name="&amp;amp;name";
run;

proc print data=cities; run;
proc print data=readings; run;

quit;
ODS HTML CLOSE;
ODS LISTING;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="map.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27772i2429826F91785826/image-size/large?v=v2&amp;amp;px=999" role="button" title="map.png" alt="map.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 13:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/541392#M17872</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-03-08T13:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting a Annotate data set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/541399#M17873</link>
      <description>Thank you Rob. I will try that. By the way, I have a few markers which are close together and overlap. The markers are color-coded as Green, Yellow and Red (with Red being the most important). Is there any way to set a transparent color scheme or some kind of priority for the colors where red always shows on the top, and yellow on top of green?</description>
      <pubDate>Fri, 08 Mar 2019 13:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/541399#M17873</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2019-03-08T13:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Subsetting a Annotate data set</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/541820#M17881</link>
      <description>&lt;P&gt;You can sort your annotate data, such that the things you want to show up 'on top' are last in the dataset, and then they will be drawn last (and show up on top) of the other annotated graphics.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Mar 2019 13:48:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Subsetting-a-Annotate-data-set/m-p/541820#M17881</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-03-10T13:48:25Z</dc:date>
    </item>
  </channel>
</rss>

