<?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: Calculate distance in miles from 1 lat/long against several lat/longs for addresses. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919839#M362313</link>
    <description>&lt;P&gt;nevermind I had the wrong table referenced, this solved it - thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2024 19:47:07 GMT</pubDate>
    <dc:creator>aarnold18</dc:creator>
    <dc:date>2024-03-11T19:47:07Z</dc:date>
    <item>
      <title>Calculate distance in miles from 1 lat/long against several lat/longs for addresses.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919825#M362306</link>
      <description>&lt;P&gt;Hi I have a table that I created using proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the latitude and longitude values for a single location (A) and then in the table I created, I have the latitude and longitude values for every address in the table. I am trying to create a flag that marks specific people within 5 miles or 10 miles from location A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone tell me how I can create another column in the table I created that calculates the distance in miles for each row compared to the single location (A)?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 18:54:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919825#M362306</guid>
      <dc:creator>aarnold18</dc:creator>
      <dc:date>2024-03-11T18:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate distance in miles from 1 lat/long against several lat/longs for addresses.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919827#M362307</link>
      <description>&lt;PRE&gt;GEODIST(latitude-1, longitude-1, latitude-2, longitude-2 &amp;lt;,options&amp;gt; )&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2024 19:05:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919827#M362307</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2024-03-11T19:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate distance in miles from 1 lat/long against several lat/longs for addresses.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919830#M362308</link>
      <description>&lt;P&gt;If you are asking for straight-line distance and not road distance you can use the GEODIST function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this is really for just one point compared with others than you could hard code the single location into the function call and just use the other data set as the source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code would&amp;nbsp; look like:&lt;/P&gt;
&lt;PRE&gt;data want;
    set have; /*this has the addresses of interest*/
   distance = geodist(fixedLat, FixedLong, addressLat, addressLong,'M');
run;&lt;/PRE&gt;
&lt;P&gt;actually to go with the function you specify whether the lat and long are in Degrees or Radians by using "DM" or "RM". The M says the result will be in miles.&lt;/P&gt;
&lt;P&gt;Fixedlat and Fixedlong are the lat and long of the one point you want to use with all the records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 19:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919830#M362308</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-11T19:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate distance in miles from 1 lat/long against several lat/longs for addresses.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919833#M362310</link>
      <description>&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this (fake target lat/long):&lt;/P&gt;&lt;P&gt;%let target_lat = 12.00000;&lt;BR /&gt;%let target_long = -40.0000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set *table with all the addresses*;&lt;/P&gt;&lt;P&gt;distance = geodist(&amp;amp;target_lat, &amp;amp;target_long, latitude, longitude, 'M');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where latitude and longitude are the column names in the table with all the addresses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately this code runs but it only gives the following columns: distance, latitude, longitude, longitude and they are all blanks.&amp;nbsp;&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;</description>
      <pubDate>Mon, 11 Mar 2024 19:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919833#M362310</guid>
      <dc:creator>aarnold18</dc:creator>
      <dc:date>2024-03-11T19:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate distance in miles from 1 lat/long against several lat/longs for addresses.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919839#M362313</link>
      <description>&lt;P&gt;nevermind I had the wrong table referenced, this solved it - thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 19:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919839#M362313</guid>
      <dc:creator>aarnold18</dc:creator>
      <dc:date>2024-03-11T19:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate distance in miles from 1 lat/long against several lat/longs for addresses.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919850#M362314</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/464403"&gt;@aarnold18&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;nevermind I had the wrong table referenced, this solved it - thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I've used SAS for over 30 years. If you believed me when I said that I never used the wrong data set I would be looking for that deed I have to the Brooklyn Bridge to sell it to you. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 20:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-distance-in-miles-from-1-lat-long-against-several-lat/m-p/919850#M362314</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-11T20:16:29Z</dc:date>
    </item>
  </channel>
</rss>

