<?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: Finding the matching in two columns? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625408#M184319</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp; See if this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data x;
      infile datalines dsd;
  input TempID_1 : $15. TempID_2 : $15.  TempID_3 : $15. ;
datalines;
21156, 8946, 7852,  
21156, 8956, 7852, 
24597, 1596, 4113,
10235, 0546, 4113,
C1156, 4286, 0008, 
200, X1O23, UV689,
208, 8MO23, UV689,
579, HL2489, GJ627,
C1156, 4986, 0008,
21156, 8956, 7852, 
;

proc sql;
create table want(drop=rn) as
select *,ifc(count(distinct tempid_1)=1,'same','Diff') as Comment
from (select *,monotonic() as rn from x)
group by tempid_3
order by rn;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind Regards!&lt;/P&gt;</description>
    <pubDate>Mon, 17 Feb 2020 19:35:39 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-02-17T19:35:39Z</dc:date>
    <item>
      <title>Finding the matching in two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625384#M184309</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset x with tempID_1 to 3.&amp;nbsp;&amp;nbsp; I would like to do the following steps:&lt;/P&gt;
&lt;P&gt;1. If TempID_3 are duplicates, and TempID_1 are the same IDs, then the comment is the same.&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp; Otherwise, it's not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Y is the result I am looking for.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
      infile datalines dsd;
  input TempID_1 : $15. TempID_2 : $15.  TempID_3 : $15. ;
datalines;
21156, 8946, 7852,  
21156, 8956, 7852, 
24597, 1596, 4113,
10235, 0546, 4113,
C1156, 4286, 0008, 
200, X1O23, UV689,
208, 8MO23, UV689,
579, HL2489, GJ627,
C1156, 4986, 0008,
21156, 8956, 7852, 
;

data y;
      infile datalines dsd;
  input TempID_1 : $15. TempID_2 : $15.  TempID_3 : $15. Comment : $15.;
datalines;
21156, 8946, 7852, same, 
21156, 8956, 7852, same,
24597, 1596, 4113, Diff,
10235, 0546, 4113, Diff,
C1156, 4286, 0008, same,
200, X1O23, UV689, Diff,
208, 8MO23, UV689, Diff,
579, HL2489,GJ627, same,
C1156, 4986, 0008, same,
21156,  , 7852, same,
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Feb 2020 18:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625384#M184309</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-02-17T18:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the matching in two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625408#M184319</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;&amp;nbsp; See if this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data x;
      infile datalines dsd;
  input TempID_1 : $15. TempID_2 : $15.  TempID_3 : $15. ;
datalines;
21156, 8946, 7852,  
21156, 8956, 7852, 
24597, 1596, 4113,
10235, 0546, 4113,
C1156, 4286, 0008, 
200, X1O23, UV689,
208, 8MO23, UV689,
579, HL2489, GJ627,
C1156, 4986, 0008,
21156, 8956, 7852, 
;

proc sql;
create table want(drop=rn) as
select *,ifc(count(distinct tempid_1)=1,'same','Diff') as Comment
from (select *,monotonic() as rn from x)
group by tempid_3
order by rn;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind Regards!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625408#M184319</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-02-17T19:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the matching in two columns?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625438#M184336</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 20:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-matching-in-two-columns/m-p/625438#M184336</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2020-02-17T20:54:04Z</dc:date>
    </item>
  </channel>
</rss>

