<?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: Relationship analysis issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535557#M147086</link>
    <description>&lt;P&gt;OK. How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Party1 party2;
cards;
1 2
1 7
2 1
2 8
2 9
3 5
3 8
7 3
8 7
9 1
;
run;

 
data want;
 if _n_=1 then do;
  if 0 then set have;
  declare hash h();
  h.definekey('party2');
  h.definedone();
 end;
set have;
if h.check(key:party1)=0 then delete;
 else h.replace();
run;

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Feb 2019 12:06:58 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-02-14T12:06:58Z</dc:date>
    <item>
      <title>Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/534922#M146840</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to create a dataset from a file such that if party has already in cluster it can not be a part of any other cluster.&lt;/P&gt;&lt;P&gt;Party1 party2&lt;/P&gt;&lt;P&gt;1 2&lt;/P&gt;&lt;P&gt;1 7&lt;/P&gt;&lt;P&gt;2 1&lt;/P&gt;&lt;P&gt;2 8&lt;/P&gt;&lt;P&gt;3 5&lt;/P&gt;&lt;P&gt;3 8&lt;/P&gt;&lt;P&gt;7 3&lt;/P&gt;&lt;P&gt;8 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically we will start by smallest party1 and all corresponding party2 for that party1 are part of cluster.&lt;/P&gt;&lt;P&gt;But for party1= 1 , 2 and 7 are already part of cluster hence all cases with party1&amp;nbsp; syartist with 2and 7 will be eliminated and smallest next party 1will be considered for cluster .so next cluster will be 3 and so on&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 16:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/534922#M146840</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-02-12T16:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/534946#M146841</link>
      <description>&lt;P&gt;You've shown us the input data, and made a description of the requirements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help us help you.&amp;nbsp; Show how you want the result data set or table to appear.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 18:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/534946#M146841</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-02-12T18:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535009#M146850</link>
      <description>&lt;P&gt;Does your example data implies that 1, 2, 3, 5, 7, 8 are all part of the same cluster?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Feb 2019 21:02:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535009#M146850</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-02-12T21:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535117#M146907</link>
      <description>Output data set would be&lt;BR /&gt;Party1 party 2&lt;BR /&gt;1 2&lt;BR /&gt;1 7&lt;BR /&gt;3 5&lt;BR /&gt;3 8</description>
      <pubDate>Wed, 13 Feb 2019 07:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535117#M146907</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-02-13T07:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535177#M146935</link>
      <description>&lt;P&gt;If I understood your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Party1 party2;
cards;
1 2
1 7
2 1
2 8
3 5
3 8
7 3
8 7
;
run;

data want;
 if _n_=1 then do;
  if 0 then set have;
  declare hash h();
  h.definekey('party2');
  h.definedone();
 end;
set have;
if h.check(key:party1)=0 then delete;
h.replace();
run;

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Feb 2019 13:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535177#M146935</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-02-13T13:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535279#M146962</link>
      <description>&lt;P&gt;Hi Ksharp ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;your response is perfect as per my concern but I missed to highlight one scenario in my query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN&gt; have&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN&gt; Party1 party2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token keyword"&gt;cards&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;1 2 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;1 7 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;2 1 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;2 8&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;2 9&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;3 5 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;3 8 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;7 3 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;8 7&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token data string"&gt;9 1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token datalines"&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;I have included one more row in cluster for prty1=2 i.e. 2 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Actually I want to excude all rows starting with prty2 values for my valid cluster.&lt;/P&gt;&lt;P&gt;since cluster starting with part1 =1 is valid cluster hence&lt;BR /&gt;all rows satrting with 2 and 7 will be discarded.&lt;/P&gt;&lt;P&gt;But since cluster starting with 2 was never considered to be a valid cluster&lt;BR /&gt;so prty2 values for this cluster rows will not be considered for row elimnation&lt;/P&gt;&lt;P&gt;so my final op will be something like&lt;/P&gt;&lt;P&gt;Party1 party2;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1 2&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1 7&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;3 5&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;3 8&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;9 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a ton in advance!!!!!!!!!!!!!!!!!!!!!!!&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 16:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535279#M146962</guid>
      <dc:creator>Rohit_1990</dc:creator>
      <dc:date>2019-02-13T16:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Relationship analysis issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535557#M147086</link>
      <description>&lt;P&gt;OK. How about this one ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Party1 party2;
cards;
1 2
1 7
2 1
2 8
2 9
3 5
3 8
7 3
8 7
9 1
;
run;

 
data want;
 if _n_=1 then do;
  if 0 then set have;
  declare hash h();
  h.definekey('party2');
  h.definedone();
 end;
set have;
if h.check(key:party1)=0 then delete;
 else h.replace();
run;

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Feb 2019 12:06:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Relationship-analysis-issue/m-p/535557#M147086</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-02-14T12:06:58Z</dc:date>
    </item>
  </channel>
</rss>

