<?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: Matching Wrong Rows From Two Tables in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Matching-Wrong-Rows-From-Two-Tables/m-p/300343#M8510</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if you have gone this route, but have you reviewed the code generated by rules defined by the wizard interface and then used that as your guide for the custom expression code? If it's all wizard-defined rules, there is a unique interplay between record level rules, field level rules, and various options to chain results of one rule to the output of another. It could be you don't quite have those options set correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out Data Management Studio &lt;A title="DM Studio Documentation" href="http://supportprod.unx.sas.com/documentation/onlinedoc/dfdmstudio/2.7/dmpdmsug/dfUnity.html" target="_blank"&gt;documentation&lt;/A&gt; (search for "surviving" on the lefthand search panel) for more details on record survivorship.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2016 12:14:11 GMT</pubDate>
    <dc:creator>RonAgresta</dc:creator>
    <dc:date>2016-09-23T12:14:11Z</dc:date>
    <item>
      <title>Matching Wrong Rows From Two Tables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Matching-Wrong-Rows-From-Two-Tables/m-p/278204#M7862</link>
      <description>&lt;P&gt;I am working with 2 tables: TBL_source and TBL_AdressMaster.&lt;/P&gt;&lt;P&gt;after I join these 2 tables by using matching codes, and cluster them, I want to select the&amp;nbsp;surviving record.&lt;/P&gt;&lt;P&gt;For that purpose I define this expression in the surviving record element:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if Not isnull(`S_Door`)  and
compare(`AM_DOOR_NUMBER_CASED_MATCHCODE`, 'S_DOOR_CASED_MATCHCODE', true) == 0  then
    return true 
else 
if isnull(`S_Door`)  and
compare(`AM_DOOR_NUMBER_CASED`, 'UNKNOWN', true) == 0  then 
    return true 
else
    return false&lt;/PRE&gt;&lt;P&gt;the idea is: when the door_numer is NULL and when there is match between source and adress master, in regard to door_number, then it should return 0.&lt;BR /&gt;When the door_numer is unknown, than it should mark exactly one row in the adress master which coinains the value "unknown" in the door_number field (this is to avoid large clusters).&lt;/P&gt;&lt;P&gt;Otherwise, return false.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second part of the expression (door_number IS NULL) seems to work as expected.&lt;BR /&gt;The first part returns unexpeted results: although there is a record in the adress_master with exactly the same door_number as in the source table, the software&amp;nbsp;matches BUT DOES NOT MARK as the &amp;nbsp;surviving record the correct row from the adressmaster.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone explain why? Did I define the expression correctly? Or do I need to do something else?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 14:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Matching-Wrong-Rows-From-Two-Tables/m-p/278204#M7862</guid>
      <dc:creator>Cyclist</dc:creator>
      <dc:date>2016-06-17T14:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Matching Wrong Rows From Two Tables</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Matching-Wrong-Rows-From-Two-Tables/m-p/300343#M8510</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know if you have gone this route, but have you reviewed the code generated by rules defined by the wizard interface and then used that as your guide for the custom expression code? If it's all wizard-defined rules, there is a unique interplay between record level rules, field level rules, and various options to chain results of one rule to the output of another. It could be you don't quite have those options set correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check out Data Management Studio &lt;A title="DM Studio Documentation" href="http://supportprod.unx.sas.com/documentation/onlinedoc/dfdmstudio/2.7/dmpdmsug/dfUnity.html" target="_blank"&gt;documentation&lt;/A&gt; (search for "surviving" on the lefthand search panel) for more details on record survivorship.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2016 12:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Matching-Wrong-Rows-From-Two-Tables/m-p/300343#M8510</guid>
      <dc:creator>RonAgresta</dc:creator>
      <dc:date>2016-09-23T12:14:11Z</dc:date>
    </item>
  </channel>
</rss>

