<?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: SAS DI SCD 2 for 2 rows in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576243#M13034</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you load multiple records with the same business key in a single batch then you don't really have control over the load order within the tuple and which record will in the end become the active one. I'm no more sure if the SCD2 generated code maintains the sort order of the source table - but even if it does it's certainly not documented nor guaranteed behaviour.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe that if you want to load multiple changes ("duplicates") in a single batch then you would need to implement the SCD2 loader within a loop transformation and feed one "duplicate" per iteration in the sequence of the changes (with the loop executing in sequence and not in parallel).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;If I recall right SCDType2 doesn't do MD5() comparison between input rows&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;You recall right.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jul 2019 16:28:57 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-07-24T16:28:57Z</dc:date>
    <item>
      <title>SAS DI SCD 2 for 2 rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576083#M12998</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CLUSTERID&amp;nbsp;NAME&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SURNAME&lt;/P&gt;&lt;P&gt;121&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Amit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Sharma&lt;BR /&gt;122&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Nikhil&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Devang&lt;BR /&gt;122&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Nikhil&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Devang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose If I am running a SAS DI SCD2 type transformation and the business key is Cluster Id and if I am generating surrogate key which is clusterno, then in the final table I am getting the values in the Active_FLAg for Nikhil Devang only in the last record of that id 122 as Y which I defined in the current indicator as Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;24JUL2019:14:42:11.074530&amp;nbsp; &amp;nbsp;24JUL2019:14:42:11.074530 122&amp;nbsp; Nikhil N 10 Devang&lt;BR /&gt;31DEC2099:00:00:00.000000&amp;nbsp; 24JUL2019:14:42:12.074530 122 Nikhil Y 10 Devang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What if I want Y in both the rows. Also if there is cluster_id in the final table. And if I insert two new entry with cluster id 122, then I would want Y for both the newly inserted cluster. How is it possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the below results&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;31DEC2099:00:00:00.000000&amp;nbsp; 24JUL2019:14:42:12.074530 122&amp;nbsp; Nikhil Y 10 Devang&lt;BR /&gt;31DEC2099:00:00:00.000000&amp;nbsp; 24JUL2019:14:42:12.074530 122 Nikhil Y 10 Devang&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Only for last value in the active flag&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 09:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576083#M12998</guid>
      <dc:creator>sameer112217</dc:creator>
      <dc:date>2019-07-24T09:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI SCD 2 for 2 rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576096#M13005</link>
      <description>&lt;P&gt;Ideally post DIS questions into the data management forum to get more people with the right skills looking into your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you're asking for is not possible - and rightly so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An SCD2 table may not have more than one current record per business key. Also overlapping start/end dates for the same business key are not allowed and would create a mess if it ever happened. That's not a SAS "thing" but how type 2 tables work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A business key is a primary key and should be unique in your source table (per load). You should implement logic for "de-duping" prior to the load into the type 2 target table.&lt;/P&gt;
&lt;P&gt;The SAS SCD2 transformation deals with duplicates the way you observe it - just by expiring duplicates "immediately" while loading - but this just increases the volumes in your type 2 table without adding value.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;....and I guess now it's also clear why there can only be a single change current indicator (active_flag) set to "Y" per business key.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 10:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576096#M13005</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-07-24T10:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI SCD 2 for 2 rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576184#M13022</link>
      <description>Actually,I think there is a use case for not deduplicating the imput - if your data changes multiple times per day, you still might want to capture this even if your bacth runs daily.&lt;BR /&gt;If I recall right SCDType2 doesn't do MD5() comparison between input rows, so the responsiblity to feed only relevant records is on the developer - deduplicting on the record rather on the key.</description>
      <pubDate>Wed, 24 Jul 2019 14:57:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576184#M13022</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2019-07-24T14:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: SAS DI SCD 2 for 2 rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576243#M13034</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you load multiple records with the same business key in a single batch then you don't really have control over the load order within the tuple and which record will in the end become the active one. I'm no more sure if the SCD2 generated code maintains the sort order of the source table - but even if it does it's certainly not documented nor guaranteed behaviour.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe that if you want to load multiple changes ("duplicates") in a single batch then you would need to implement the SCD2 loader within a loop transformation and feed one "duplicate" per iteration in the sequence of the changes (with the loop executing in sequence and not in parallel).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;If I recall right SCDType2 doesn't do MD5() comparison between input rows&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;You recall right.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-DI-SCD-2-for-2-rows/m-p/576243#M13034</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-07-24T16:28:57Z</dc:date>
    </item>
  </channel>
</rss>

