<?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 Re: US States Heat Map including Territories in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582219#M18713</link>
    <description>Just PR and VI for now.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 19 Aug 2019 19:10:16 GMT</pubDate>
    <dc:creator>altijani</dc:creator>
    <dc:date>2019-08-19T19:10:16Z</dc:date>
    <item>
      <title>US States Heat Map including Territories</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/581860#M18704</link>
      <description>&lt;P&gt;I need to create a heat map for the US and its territories. I am using this code, which is giving me what I need for the "main land", but not the territories. I am using my own data&amp;nbsp;for the values that create the heat map's color for each state.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 

proc sort data=mapsgfk.us out=USBorders2 equals;

by statecode;

run;

proc sort data=sashelp.us_data(keep=density_2010 statecode) out=USDensity;

by statecode;

run;

data USDensity2;

merge USBorders2 USDensity;

by statecode;

if statecode ne '' then density_2010 = 100 ;

if statecode = 'IL' then density_2010 = - 20; 

if statecode = 'IN' then density_2010 = 88;

if statecode = 'IA' then density_2010 = 68;

if statecode = 'KS' then density_2010 = - 20; 

if statecode = 'KY' then density_2010 = 87;

if statecode = 'MI' then density_2010 = 41;

if statecode = 'MN' then density_2010 = - 20; 

if statecode = 'MO' then density_2010 = - 20; 

if statecode = 'NE' then density_2010 = - 20; 

if statecode = 'OH' then density_2010 = 46;

if statecode = 'WI' then density_2010 = - 20; 

if statecode = 'CT' then density_2010 = 90;

if statecode = 'DE' then density_2010 = 68;

if statecode = 'DC' then density_2010 = - 20; 

if statecode = 'ME' then density_2010 = - 20; 

if statecode = 'MD' then density_2010 = - 20; 

if statecode = 'MA' then density_2010 = 59; 

if statecode = 'NH' then density_2010 = - 20; 

if statecode = 'NJ' then density_2010 = 53; 

if statecode = 'NY' then density_2010 = 89;

if statecode = 'PA' then density_2010 = 62;

if statecode = 'RI' then density_2010 = - 20; 

if statecode = 'VT' then density_2010 = - 20; 

if statecode = 'AL' then density_2010 = 68;

if statecode = 'FL' then density_2010 = 49;

if statecode = 'GA' then density_2010 = - 20; 

if statecode = 'NC' then density_2010 = - 20; 

if statecode = 'SC' then density_2010 = - 20; 

if statecode = 'TN' then density_2010 = 87;
if statecode = 'VA' then density_2010 = - 20; 

if statecode = 'WV' then density_2010 = - 20; 

if statecode = 'AR' then density_2010 = 52; 

if statecode = 'CO' then density_2010 = 48;

if statecode = 'LA' then density_2010 = 27;

if statecode = 'MS' then density_2010 = 48;

if statecode = 'NM' then density_2010 = 77;

if statecode = 'OK' then density_2010 = 59; 

if statecode = 'TX' then density_2010 = 38;

if statecode = 'ND' then density_2010 = - 20; 

if statecode = 'AK' then density_2010 = 72;

if statecode = 'AS' then density_2010 = - 20; 

if statecode = 'AZ' then density_2010 = 38;

if statecode = 'CA' then density_2010 = - 20; 

if statecode = 'HI' then density_2010 = - 20; 

if statecode = 'ID' then density_2010 = 49; 

if statecode = 'MT' then density_2010 = 30;

if statecode = 'NV' then density_2010 = 43;

if statecode = 'OR' then density_2010 = 41;

if statecode = 'SD' then density_2010 = - 20; 

if statecode = 'UT' then density_2010 = 48; 

if statecode = 'WA' then density_2010 = 50; 

if statecode = 'WY' then density_2010 = 61;

if statecode = 'VI' then density_2010 = 49;

if statecode = 'PR' then density_2010 = 83;

run;

 

　

　

　

%annomac /* Make the SAS/GRAPH annotate macros available */

%centroid(mapsgfk.us,centers2,id) /* Polygon center is used to place each label */

data map2(drop=statecode segment);

set USDensity2 centers2(rename=(x=xCen y=yCen) in=a);

if a then Label=fipstate(input(substr(id,4,2), 2.)); /* State postal code */

id = catx('-', id, segment); /* Combine ID and Segment to make unique ID */

if label = 'ID' then ycen + -.025; /* Adjust a few label coordinates */

if label = 'MI' then ycen + -.025;

if label = 'HI' then ycen + -.01;

if label = 'NH' then ycen + -.012;

if label = 'VT' then ycen + .01;

if label = 'MD' then do; ycen + -.02; xcen + .037; end;

if label = 'AK' then ycen + .01;

if label = 'DE' then do; ycen + -.005; xcen + .025; end;

if label = 'CT' then do; ycen + -.009; xcen + .032; end;

if label = 'NJ' then do; xcen + .015; end;

if label = 'RI' then do; xcen + .015; end;

if label = 'DC' then delete;

run;

 

options orientation=landscape;

ods graphics on / height=7.6in width=12.8in;

ods pdf file='nv_highlow.pdf' notoc dpi=300;

 

proc sgplot data=map2 noautolegend;

title height=5 'Heat Map, 2019';

footnote height=3 "Notes, Notes, Notes" c=gray;

footnote height=3 "State Name" c=gray;

polygon x=x y=y id=id / outline lineattrs=(color=blue)

 

colorresponse=density_2010 dataSkin=matte



fill colormodel=(white red white green) name='map2';

scatter x=xcen y=ycen / markerchar=label markercharattrs=(size=10);

gradlegend 'map2';

label density_2010 = ' High Risk     Low Risk';

xaxis offsetmin=0.01 offsetmax=0.01 display=none;

yaxis offsetmin=0.01 offsetmax=0.01 display=none;

run;

ods graphics on / reset=all;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Aug 2019 20:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/581860#M18704</guid>
      <dc:creator>altijani</dc:creator>
      <dc:date>2019-08-16T20:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: US States Heat Map including Territories</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582215#M18712</link>
      <description>&lt;P&gt;Which other 'territories' are you wanting, and where would you like for them to show up in the map?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You'll likely have to subset them from another map, and then re-scale them, and apply x/y offsets, to get them to show up 'around' the main US 48 states (like Hawaii and Alaska often are).&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 18:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582215#M18712</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-08-19T18:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: US States Heat Map including Territories</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582219#M18713</link>
      <description>Just PR and VI for now.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Aug 2019 19:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582219#M18713</guid>
      <dc:creator>altijani</dc:creator>
      <dc:date>2019-08-19T19:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: US States Heat Map including Territories</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582761#M18740</link>
      <description>&lt;P&gt;mapsgfk.us_all contains Puerto Rico and Virgin Islands ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc gmap data=mapsgfk.us_all map=mapsgfk.us_all;&lt;BR /&gt;id id;&lt;BR /&gt;choro statecode;&lt;BR /&gt;run;&lt;/P&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="us_all_map.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31903iBFFD145159710B7F/image-size/large?v=v2&amp;amp;px=999" role="button" title="us_all_map.png" alt="us_all_map.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 13:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/US-States-Heat-Map-including-Territories/m-p/582761#M18740</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-08-21T13:18:59Z</dc:date>
    </item>
  </channel>
</rss>

