<?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: Nearest neighbor in a data set in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Nearest-neighbor-in-a-data-set/m-p/547847#M8446</link>
    <description>&lt;P&gt;Use PROC MODECLUS. The NEIGHBOR option on the PROC MODECLUS statement produces a table that gives the observation number (or ID value) of nearest neighbors. For example, the following statements produce the observation numbers for the nearest neighbors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Use K=p option to find nearest p-1 neighbors */&lt;BR /&gt;proc modeclus data=Sample method=1 k=101 Neighbor; /* nearest 100 nbrs */&lt;BR /&gt;var x y z w;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you start with a smaller problem, such as the nearest&amp;nbsp;2 neighbors, before attempting the large problem. &lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=15.1&amp;amp;docsetTarget=statug_modeclus_examples02.htm&amp;amp;locale=en" target="_self"&gt;The MODECLUS doc has an example for nearest neighbors.&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2019 10:42:20 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-04-02T10:42:20Z</dc:date>
    <item>
      <title>Nearest neighbor in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Nearest-neighbor-in-a-data-set/m-p/547815#M8443</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to implement a nearest neighbors algorithm. More specifically, I have more than 300000 customers and I need to find nearest 100 customers 50 above them and 50 below them on the basis of their Latitude value (variable name) which i have sorted in ascending, suppose customer who is in 1st row then he has 0 customers above him so his closest 100 customers will be 100 below them i.e 1-100 and like wise customer who is on 51st row then his above 50 will be 1-50 customers and below will be 51-100, like wise it will process for all the&amp;nbsp;300000 customers and a new data set will be created by appending all the data set in one which will be of 300000*100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am importing the file and then sorting the data on the basis of&amp;nbsp;Latitude value and then assigning the row number after that i am helpless.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = sample; by Latitude; run;
data sample;                                                                                                                                           
  set sample ;                                                                                                                                         
  row_number=_n_;                                                                                                                                          
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Oct 2019 07:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Nearest-neighbor-in-a-data-set/m-p/547815#M8443</guid>
      <dc:creator>umeshgiri48</dc:creator>
      <dc:date>2019-10-25T07:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Nearest neighbor in a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Nearest-neighbor-in-a-data-set/m-p/547847#M8446</link>
      <description>&lt;P&gt;Use PROC MODECLUS. The NEIGHBOR option on the PROC MODECLUS statement produces a table that gives the observation number (or ID value) of nearest neighbors. For example, the following statements produce the observation numbers for the nearest neighbors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Use K=p option to find nearest p-1 neighbors */&lt;BR /&gt;proc modeclus data=Sample method=1 k=101 Neighbor; /* nearest 100 nbrs */&lt;BR /&gt;var x y z w;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you start with a smaller problem, such as the nearest&amp;nbsp;2 neighbors, before attempting the large problem. &lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=15.1&amp;amp;docsetTarget=statug_modeclus_examples02.htm&amp;amp;locale=en" target="_self"&gt;The MODECLUS doc has an example for nearest neighbors.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 10:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Nearest-neighbor-in-a-data-set/m-p/547847#M8446</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-04-02T10:42:20Z</dc:date>
    </item>
  </channel>
</rss>

