<?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 zip code level map for all the states using gmap in sas in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292196#M10306</link>
    <description>&lt;P&gt;I don't understand your Proc GMAP.&amp;nbsp; You have "choro zip" but I don't see where you assigned "zip" to MAP.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I put a data step above your code with the ZIP Code for SAS:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; allx;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Postal_Zip___Personal_Dta=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'27513'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;And I changed the "choro state" and it produces a small dot in NC where that ZIP code is.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;If yours is working and drawing the dots, it could be that you have ZIP Codes that are on the coast or on an island and the map isn't fine grained enough to show the exact coast line.&amp;nbsp; These will produce that message if it is slightly in the water.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;You may want to make your dots bigger.&amp;nbsp; This macro will do that:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/*-----------------------------------------------------------*/&lt;BR /&gt;/* Macro to create point data in an annotate data set&lt;BR /&gt;&amp;nbsp;* annodata = point annotate data set created.&amp;nbsp; &lt;BR /&gt;&amp;nbsp;* inputdata = Input data set containing points to be drawn. &lt;BR /&gt;&amp;nbsp;*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note that this data must contain variables x and y &lt;BR /&gt;&amp;nbsp;*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with the location of the points.&lt;BR /&gt;&amp;nbsp;* color = Graph color.&amp;nbsp; eg: red&lt;BR /&gt;&amp;nbsp;* size = dot size (optional).&amp;nbsp; Default is .7;&lt;BR /&gt;&amp;nbsp;* tipvar = Variable name to be used for tool tip (optional).&lt;BR /&gt;&amp;nbsp;* Note:&amp;nbsp; search for ????? for items that can be modified.&lt;BR /&gt;&amp;nbsp;*/&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;%macro make_dots(annodata, inputdata, color, size, tipvar); &lt;BR /&gt;data &amp;amp;annodata;&lt;BR /&gt;&amp;nbsp; length function color $ 8 style $20 position $ 1 text $ 60 html $1024;&lt;BR /&gt;&amp;nbsp; retain xsys ysys '2' hsys '3' when 'a' size .7;&lt;BR /&gt;&amp;nbsp; set &amp;amp;inputdata;&lt;BR /&gt;&amp;nbsp; /*optional arguments*/&lt;BR /&gt;&amp;nbsp; %if (&amp;amp;size ^= ) %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; size=&amp;amp;size;&lt;BR /&gt;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp; /* All annotate points are 360-degree pies.&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; function='pie';&lt;BR /&gt;&amp;nbsp; rotate=360;&lt;BR /&gt;&amp;nbsp; style='psolid';&lt;BR /&gt;&amp;nbsp; color=&amp;amp;color;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* optional tool tips */&lt;BR /&gt;&amp;nbsp; %if (&amp;amp;tipvar ^= ) %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html= 'title=' || quote("&amp;amp;tipvar" ||'=' || trim(left(&amp;amp;tipvar)) );&lt;BR /&gt;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2016 14:21:10 GMT</pubDate>
    <dc:creator>Darrell_sas</dc:creator>
    <dc:date>2016-08-17T14:21:10Z</dc:date>
    <item>
      <title>us zip code level map for all the states using gmap in sas</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292093#M10301</link>
      <description>&lt;P&gt;Am trynig to draw a choropleth map for all states of us using zipcodes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Following is the error: &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROBLEM IN OBSERVATION 2 -&lt;BR /&gt;DATA SYSTEM REQUESTED, BUT VALUE IS NOT ON GRAPH 'X'&lt;BR /&gt;NOTE: PROBLEM IN OBSERVATION 3 -&lt;BR /&gt;DATA SYSTEM REQUESTED, BUT VALUE IS NOT ON GRAPH 'X'&lt;BR /&gt;NOTE: PROBLEM IN OBSERVATION 4 -&lt;BR /&gt;DATA SYSTEM REQUESTED, BUT VALUE IS NOT ON GRAPH 'X'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the code....&lt;/P&gt;&lt;P&gt;proc sort data=allx out=myzip ;by Postal_Zip___Personal_Dta; run;&lt;/P&gt;&lt;P&gt;/* convert data type of Postal_Zip___Personal_Dta to numeric */&lt;BR /&gt;data myzip1;&lt;BR /&gt;set myzip;&lt;BR /&gt;zip1=put(input(Postal_Zip___Personal_Dta,5.),z5.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data myzip1;&lt;BR /&gt;set myzip1;&lt;BR /&gt;format zip z5.;&lt;BR /&gt;zip=zip1*1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=myzip1 out=myzip2;by zip;run;&lt;/P&gt;&lt;P&gt;/* Create a data set containing the */&lt;BR /&gt;/* X and Y values for my ZIP codes. */&lt;/P&gt;&lt;P&gt;data longlat;&lt;BR /&gt;/* In case there are duplicate ZIP codes, rename&lt;BR /&gt;X and Y from the SASHELP.ZIPCODE data set. */&lt;BR /&gt;merge myzip2(in=mine)&lt;BR /&gt;sashelp.zipcode(rename=(x=long y=lat)keep=x y zip);&lt;BR /&gt;by zip;&lt;BR /&gt;/* Keep if the ZIP code was in my data set. */&lt;BR /&gt;if mine;&lt;BR /&gt;/* Convert longitude, latitude in degrees to radians */&lt;BR /&gt;/* to match the values in the map data set. */&lt;BR /&gt;x=atan(1)/45*long;&lt;BR /&gt;y=atan(1)/45*lat;&lt;BR /&gt;/* Adjust the hemisphere */&lt;BR /&gt;x=-x;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let color1=cxF3F7FE;&lt;BR /&gt;%let color2=cx6497EB;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc template;&lt;BR /&gt;define style styles.colorramp;&lt;BR /&gt;parent=styles.default;&lt;BR /&gt;style twocolorramp / startcolor=&amp;amp;color1 endcolor=&amp;amp;color2;&lt;BR /&gt;class body / backgroundcolor=white;&lt;BR /&gt;class table / backgroundcolor=white;&lt;BR /&gt;class header, footer / backgroundcolor=white;&lt;BR /&gt;class data / backgroundcolor=white;&lt;BR /&gt;class systemtitle / backgroundcolor=white;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;/* Create an annotate data set &amp;nbsp;*/&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;data stlabel_zip;&lt;BR /&gt;length function style color $ 10 position $ 1 text $5;&lt;BR /&gt;retain flag 1 function 'label' xsys ysys '2' hsys '3' when 'a' ;&lt;/P&gt;&lt;P&gt;set longlat;&lt;BR /&gt;color= 'black';&lt;BR /&gt;text=put(stcnt,comma5.);&lt;BR /&gt;position = '5';&lt;BR /&gt;size = 2.5;&lt;BR /&gt;style = 'colorramp';&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data all;&lt;BR /&gt;/* Subset out the states that you do not want. */&lt;BR /&gt;/* The FIPS code of 2 is Alaska, 15 is Hawaii, */&lt;BR /&gt;/* and 72 is Puerto Rico. */&lt;BR /&gt;set maps.states(where=(state not in(2 15 72))) stlabel_zip;&lt;BR /&gt;run;&lt;BR /&gt;proc gproject data=all out=allproj;&lt;BR /&gt;id state;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data map dot;&lt;BR /&gt;set allproj;&lt;BR /&gt;/* If the FLAG variable has a value of 1, it is an annotate */&lt;BR /&gt;/* observation; otherwise, it is a map data set observation. */&lt;BR /&gt;if flag=1 then output dot;&lt;BR /&gt;else output map;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc gmap data=map map=map;&lt;BR /&gt;id state;&lt;BR /&gt;choro zip / anno=dot nolegend;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 08:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292093#M10301</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2016-08-17T08:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: us zip code level map for all the states using gmap in sas</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292196#M10306</link>
      <description>&lt;P&gt;I don't understand your Proc GMAP.&amp;nbsp; You have "choro zip" but I don't see where you assigned "zip" to MAP.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I put a data step above your code with the ZIP Code for SAS:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; allx;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;Postal_Zip___Personal_Dta=&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'27513'&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;And I changed the "choro state" and it produces a small dot in NC where that ZIP code is.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;If yours is working and drawing the dots, it could be that you have ZIP Codes that are on the coast or on an island and the map isn't fine grained enough to show the exact coast line.&amp;nbsp; These will produce that message if it is slightly in the water.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;You may want to make your dots bigger.&amp;nbsp; This macro will do that:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;/*-----------------------------------------------------------*/&lt;BR /&gt;/* Macro to create point data in an annotate data set&lt;BR /&gt;&amp;nbsp;* annodata = point annotate data set created.&amp;nbsp; &lt;BR /&gt;&amp;nbsp;* inputdata = Input data set containing points to be drawn. &lt;BR /&gt;&amp;nbsp;*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note that this data must contain variables x and y &lt;BR /&gt;&amp;nbsp;*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with the location of the points.&lt;BR /&gt;&amp;nbsp;* color = Graph color.&amp;nbsp; eg: red&lt;BR /&gt;&amp;nbsp;* size = dot size (optional).&amp;nbsp; Default is .7;&lt;BR /&gt;&amp;nbsp;* tipvar = Variable name to be used for tool tip (optional).&lt;BR /&gt;&amp;nbsp;* Note:&amp;nbsp; search for ????? for items that can be modified.&lt;BR /&gt;&amp;nbsp;*/&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;%macro make_dots(annodata, inputdata, color, size, tipvar); &lt;BR /&gt;data &amp;amp;annodata;&lt;BR /&gt;&amp;nbsp; length function color $ 8 style $20 position $ 1 text $ 60 html $1024;&lt;BR /&gt;&amp;nbsp; retain xsys ysys '2' hsys '3' when 'a' size .7;&lt;BR /&gt;&amp;nbsp; set &amp;amp;inputdata;&lt;BR /&gt;&amp;nbsp; /*optional arguments*/&lt;BR /&gt;&amp;nbsp; %if (&amp;amp;size ^= ) %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; size=&amp;amp;size;&lt;BR /&gt;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp; /* All annotate points are 360-degree pies.&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; function='pie';&lt;BR /&gt;&amp;nbsp; rotate=360;&lt;BR /&gt;&amp;nbsp; style='psolid';&lt;BR /&gt;&amp;nbsp; color=&amp;amp;color;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /* optional tool tips */&lt;BR /&gt;&amp;nbsp; %if (&amp;amp;tipvar ^= ) %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html= 'title=' || quote("&amp;amp;tipvar" ||'=' || trim(left(&amp;amp;tipvar)) );&lt;BR /&gt;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp; output;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 14:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292196#M10306</guid>
      <dc:creator>Darrell_sas</dc:creator>
      <dc:date>2016-08-17T14:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: us zip code level map for all the states using gmap in sas</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292378#M10317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Following is my data, and I want to draw a map for count of &amp;nbsp;stcnt at &amp;nbsp;zipcode level &amp;nbsp;for each statecode.&lt;/P&gt;&lt;P&gt;I have three variables Zip Stcnt Statecode.&lt;/P&gt;&lt;P&gt;data allx;&lt;BR /&gt;input zip statecode$ stcnt;&lt;BR /&gt;cards;&lt;BR /&gt;07302 NJ 18&lt;BR /&gt;80012 CO 2&lt;BR /&gt;00602 PR 24&lt;BR /&gt;00646 PR 26&lt;BR /&gt;00646 PR 45&lt;BR /&gt;01001 CT 26&lt;BR /&gt;01010 MA 45&lt;BR /&gt;01050 MA 56&lt;BR /&gt;01056 CT 68&lt;BR /&gt;02155 NH 69&lt;BR /&gt;02339 RI 14&lt;BR /&gt;02351 RI 09&lt;BR /&gt;03873 NH 56&lt;BR /&gt;04005 ME 76&lt;BR /&gt;04021 ME 68&lt;BR /&gt;05408 VT 09&lt;BR /&gt;0623 CA 21&lt;BR /&gt;07003 NY 24&lt;BR /&gt;07006 NY 19&lt;BR /&gt;07030 PA 66&lt;BR /&gt;28217 GA 9&lt;BR /&gt;28217 NC 56&lt;BR /&gt;29710 SC 08&lt;BR /&gt;29710 NC 89&lt;BR /&gt;30019 FL 78&lt;BR /&gt;30019 GA 68&lt;BR /&gt;30188 WI 45&lt;BR /&gt;32086 KS 56&lt;BR /&gt;32256 MA 44&lt;BR /&gt;32259 UT 42&lt;BR /&gt;32566 LA 8&lt;BR /&gt;33173 MD 44&lt;BR /&gt;3411 KY 42&lt;BR /&gt;35043 AL 56&lt;BR /&gt;35094 AL 45&lt;BR /&gt;37013 TN 22&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 08:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292378#M10317</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2016-08-18T08:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: us zip code level map for all the states using gmap in sas</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292427#M10319</link>
      <description>&lt;P&gt;I had to change your program around to make it work.&amp;nbsp; In ALLX. you did not have Postal_Zip___Personal_Dta&amp;nbsp;listed.&lt;/P&gt;
&lt;P&gt;data allx;&lt;/P&gt;
&lt;P&gt;input Postal_Zip___Personal_Dta $ statecode$ stcnt;&lt;/P&gt;
&lt;P&gt;length zip 5;&lt;/P&gt;
&lt;P&gt;zip=Postal_Zip___Personal_Dta;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And in the GMAP, i had to change 'CHORO ZIP' to "CHORO STATE".&amp;nbsp; ZIP must be in the "MAP" data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CHORO does not work with the ANNOTATE data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, your messages are&amp;nbsp;coming out&amp;nbsp;because you have Puerto Rico (PR) in your ZIP Codes and you&amp;nbsp;do not have it in your map.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 12:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/us-zip-code-level-map-for-all-the-states-using-gmap-in-sas/m-p/292427#M10319</guid>
      <dc:creator>Darrell_sas</dc:creator>
      <dc:date>2016-08-18T12:36:46Z</dc:date>
    </item>
  </channel>
</rss>

