<?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: Lat/Long in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12523#M1366</link>
    <description>I would approach this with PROC SQL to obtain a Cartesian product of the Store ZIP code data with itself.  That would yield a table with &lt;BR /&gt;
&lt;BR /&gt;
store ZIP store2 ZIP2&lt;BR /&gt;
&lt;BR /&gt;
as columns.  Then you could use the ZIPCITYDISTANCE function to compute the distance between two ZIPs.  Something like.&lt;BR /&gt;
&lt;BR /&gt;
*untested code;&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE both AS&lt;BR /&gt;
SELECT a.store, a.ZIP, &lt;BR /&gt;
  b.store AS store2,&lt;BR /&gt;
  b.zip AS ZIP2,&lt;BR /&gt;
  ZIPCITYDISTANCE(a.zip, b.zip) AS Distance&lt;BR /&gt;
FROM a,b;&lt;BR /&gt;
QUIT; RUN;&lt;BR /&gt;
&lt;BR /&gt;
Be sure to download the latest version of SASHELP.ZIPCODE (see the SAS manual for the function).</description>
    <pubDate>Tue, 14 Jun 2011 03:14:32 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2011-06-14T03:14:32Z</dc:date>
    <item>
      <title>Lat/Long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12522#M1365</link>
      <description>I've a table that looks like this..&lt;BR /&gt;
Store #	Zip Code	Lat #	Long #&lt;BR /&gt;
A1	12223		&lt;BR /&gt;
B2	45677		&lt;BR /&gt;
B3	12345		&lt;BR /&gt;
B4	12234		&lt;BR /&gt;
A3	67543		&lt;BR /&gt;
&lt;BR /&gt;
Using Lat / Long  of a location  getting the proxmity  of each location for example store A1 is 2 miles from the nearest next store and store B2 is 4 miles to the nearest  next store.... Thank You again for your assitance</description>
      <pubDate>Tue, 14 Jun 2011 01:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12522#M1365</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2011-06-14T01:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Lat/Long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12523#M1366</link>
      <description>I would approach this with PROC SQL to obtain a Cartesian product of the Store ZIP code data with itself.  That would yield a table with &lt;BR /&gt;
&lt;BR /&gt;
store ZIP store2 ZIP2&lt;BR /&gt;
&lt;BR /&gt;
as columns.  Then you could use the ZIPCITYDISTANCE function to compute the distance between two ZIPs.  Something like.&lt;BR /&gt;
&lt;BR /&gt;
*untested code;&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE both AS&lt;BR /&gt;
SELECT a.store, a.ZIP, &lt;BR /&gt;
  b.store AS store2,&lt;BR /&gt;
  b.zip AS ZIP2,&lt;BR /&gt;
  ZIPCITYDISTANCE(a.zip, b.zip) AS Distance&lt;BR /&gt;
FROM a,b;&lt;BR /&gt;
QUIT; RUN;&lt;BR /&gt;
&lt;BR /&gt;
Be sure to download the latest version of SASHELP.ZIPCODE (see the SAS manual for the function).</description>
      <pubDate>Tue, 14 Jun 2011 03:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12523#M1366</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2011-06-14T03:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Lat/Long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12524#M1367</link>
      <description>The function GEODIST returns the geodetic distance between two latitude and longitude coordinates. So Doc's code could be modified to use that function and &lt;BR /&gt;
GEODIST(A.lat, A.long, B.lat,b.long,'M') as Distance.</description>
      <pubDate>Tue, 14 Jun 2011 17:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12524#M1367</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2011-06-14T17:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Lat/Long</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12525#M1368</link>
      <description>I have version 9.1 SAS loaded in my desktop  when I ran the code it error out " It stated the zipcitydistance function didn't exist. I read on the net that its new for 9.2  if that is the case what can I use to tweak it? I will try the GeoDist... Thank you again for your assitance... What I would like the code to provide in miles is  the nearest store... for example store 1 is 3 miles from store 3 and store 2 is 5 miles from store 1  ... Again thanks</description>
      <pubDate>Wed, 15 Jun 2011 00:30:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lat-Long/m-p/12525#M1368</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2011-06-15T00:30:41Z</dc:date>
    </item>
  </channel>
</rss>

