<?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: Scd type 2 close out in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586970#M17952</link>
    <description>&lt;P&gt;I have given the run date in the mapping to Column(valid_from_dttm)&lt;/P&gt;&lt;P&gt;&amp;nbsp;Expression("&amp;amp;RPT_DTTM."DT).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be frank every thing is fine and loading properly as I required but the issue is creating new RK for closed out records when reopened&lt;/P&gt;&lt;P&gt;I need to know why and how to solve it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And sorry for late reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Sat, 07 Sep 2019 11:27:47 GMT</pubDate>
    <dc:creator>Srikanth713</dc:creator>
    <dc:date>2019-09-07T11:27:47Z</dc:date>
    <item>
      <title>Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586377#M17912</link>
      <description>I have a problem with closeout records and as records are closed in Target table since records are not coming from source and when ever the closed record id again coming after few days it is creating the new RK value for same record and it is not picking the same RK value from previous.what can I do for picking same RK and open the record.</description>
      <pubDate>Thu, 05 Sep 2019 11:19:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586377#M17912</guid>
      <dc:creator>Srikanth713</dc:creator>
      <dc:date>2019-09-05T11:19:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586578#M17926</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The SCD2 loader will use the same generated key for the same business key if you've ticked the box for the key to be a retained key.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 00:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586578#M17926</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-06T00:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586590#M17928</link>
      <description>Yes I have given the retain key for account id as business key but it's creating a new RK value of same id for close records when it is reopend</description>
      <pubDate>Fri, 06 Sep 2019 01:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586590#M17928</guid>
      <dc:creator>Srikanth713</dc:creator>
      <dc:date>2019-09-06T01:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586593#M17929</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288473"&gt;@Srikanth713&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you're saying that:&lt;/P&gt;
&lt;P&gt;Day 1: source with a new business key X - inserts a row in target with a new RK&lt;/P&gt;
&lt;P&gt;Day 2: source with same business key X but a change in another column- expires record from day1 in target, inserts new row with same RK&lt;/P&gt;
&lt;P&gt;Day 3: source doesn't have row with business key X - expires current record in target&lt;/P&gt;
&lt;P&gt;Day 4: source with business key X - inserts row but creates a new value for RK&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is that what you observe? Do you really have such a case in your target table? And are you 100% sure that the business key is the same (inclusive some invisible "garbage" characters due to DQ issues)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And just to ask:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you also have a change current indicator column? (there is an issue with the SCD2 loader if you don't).&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 01:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586593#M17929</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-06T01:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586607#M17931</link>
      <description>Day1: suppose I am loading 100 records source and Target contains 100 records&lt;BR /&gt;Day:2 I am loading empty source of next rundate so all the records in the target are closed&lt;BR /&gt;Day:now i am loading those all the 100 records of same business id from source so now it is creating new RK(reference key) from 101 to 200 and now here I need to pickup the from old RK only not new as id is same&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Fri, 06 Sep 2019 03:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586607#M17931</guid>
      <dc:creator>Srikanth713</dc:creator>
      <dc:date>2019-09-06T03:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586616#M17932</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288473"&gt;@Srikanth713&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I'd like to know and why my sample has 4 days: Do you have any cases in your target table where you've got multiple rows with the same RK and business key? You're currently tying the issue to re-opening records. I'd like to know if RK population works at all for you.&lt;/P&gt;
&lt;P&gt;Also: Do you have a change current indicator column defined? This is a required column due to a bug in the SCD2 generated code.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 04:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586616#M17932</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-06T04:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586625#M17933</link>
      <description>Yeah I have used the current indicator also but still it's giving me the same result and I need to know is whether the same RK is picked or not when the closed record is reopened.&lt;BR /&gt;&lt;BR /&gt;Thank you</description>
      <pubDate>Fri, 06 Sep 2019 05:43:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586625#M17933</guid>
      <dc:creator>Srikanth713</dc:creator>
      <dc:date>2019-09-06T05:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586632#M17934</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288473"&gt;@Srikanth713&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've used the SCD2 loader already in many DIS jobs and version and it works as it should based on how you configure it. The only specialty I know off if is the need for a change current indicator column. This also includes the RK; I can't recall ever having had the problem you describe.&lt;/P&gt;
&lt;P&gt;If your target table is not a SAS but a database table then you will have a bit more work to not only set-up functionally correct but also performing code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're really convinced that you've configured everything correctly and also executed valid test cases then I believe best next option is to investigate the SAS Log and the DIS generated SAS code to figure out where the logic is incorrect.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May be also post screenshots here showing us how you've actually configured the transformation.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 06:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586632#M17934</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-06T06:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586637#M17935</link>
      <description>&lt;P&gt;Instead of trying to fix/trouble shoot this, you could perhaps go around it instead.&lt;/P&gt;
&lt;P&gt;This by changing the data model slightly.&lt;/P&gt;
&lt;P&gt;I'm usually quite hesistant on end dating the last record for a key. I think the validation date interval shall describe the validility of the data record, not the validility of the key itself.&lt;/P&gt;
&lt;P&gt;To describe if a key is still active or not, use status code and/or status date columns instead.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 07:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586637#M17935</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2019-09-06T07:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586657#M17936</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG-20190906-WA0005.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32252i972D880F3CEE4D2D/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG-20190906-WA0005.jpg" alt="IMG-20190906-WA0005.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG-20190906-WA0001.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32254iDA9370AB6BC71BC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG-20190906-WA0001.jpg" alt="IMG-20190906-WA0001.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG-20190906-WA0004.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32253iF9F6E3AD82EB2BFD/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG-20190906-WA0004.jpg" alt="IMG-20190906-WA0004.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG-20190906-WA0000.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32255i5F5A8EA7568E31A1/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG-20190906-WA0000.jpg" alt="IMG-20190906-WA0000.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="IMG-20190906-WA0002.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32256i6A0E1CEC3CF3D84A/image-size/large?v=v2&amp;amp;px=999" role="button" title="IMG-20190906-WA0002.jpg" alt="IMG-20190906-WA0002.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 07:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586657#M17936</guid>
      <dc:creator>Srikanth713</dc:creator>
      <dc:date>2019-09-06T07:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586662#M17937</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288473"&gt;@Srikanth713&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expression for your valid_from_dttm column can't be right. It needs to be something like datetime() or any other expression that returns a constant SAS datetime value. Using a variable from your table is certainly the wrong thing to do.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32257i690C69B0E4D5205B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't tell 100% but it's likely that fixing above will also resolve the RK issue. You need to fix and retest first.&lt;/P&gt;
&lt;P&gt;...and I would assume your current target table is "messed up" so best start retesting with an empty target table.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2019 08:30:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586662#M17937</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-06T08:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586970#M17952</link>
      <description>&lt;P&gt;I have given the run date in the mapping to Column(valid_from_dttm)&lt;/P&gt;&lt;P&gt;&amp;nbsp;Expression("&amp;amp;RPT_DTTM."DT).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To be frank every thing is fine and loading properly as I required but the issue is creating new RK for closed out records when reopened&lt;/P&gt;&lt;P&gt;I need to know why and how to solve it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And sorry for late reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2019 11:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/586970#M17952</guid>
      <dc:creator>Srikanth713</dc:creator>
      <dc:date>2019-09-07T11:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Scd type 2 close out</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/587043#M17953</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288473"&gt;@Srikanth713&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for not believing you.&lt;/P&gt;
&lt;P&gt;I've created now a DIS job (with version 4.903) to prove to you that things work as they should only to proof to myself that they don't.&lt;/P&gt;
&lt;P&gt;I can replicate what you describe. I couldn't find a resolution within the SCD2 loader itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if that's an issue which has been introduced with one of the newer DIS versions because I was really in the believe I've used the retained key generation in the past and it worked. ....but may be I'm just confused.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need a quick solution then I can't think of anything else than either a pre- or post process which maintains the key (you can eventually use the surrogate key generator transformation for it), or use your business column if numeric and just map it into the retained key column, or define the retained key as being character 32 and create a digest value using the business key, ...or drop the retained key at all from your target table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking into the DIS generated code I believe the issue is this code bit.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;            /* Sort target table records before creating the temporary cross reference  */ 
            /*  table:                                                                  */ 
            proc sort data = mywork.scd2_multiday_target(where = (change_current_ind = 'Y'))
               out = work.etls_sortedxref(keep=retained_key busikey_1 busikey_2 VALID_FROM_DTTM VALID_TO_DTTM 
                change_current_ind  change_tracked_var);
               by busikey_1 busikey_2;
            run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It always annoyed me that change_current_ind gets set to 'N' also when only expiring a record without adding a new changed record.&lt;/P&gt;
&lt;P&gt;This way it's totally redundant information to all records with a valid_to_dttm in the far future.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But now because it's implemented the way it is below selection won't include expired records even if they are the most current change.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;proc sort data = mywork.scd2_multiday_target(&lt;FONT color="#FF0000"&gt;where = (change_current_ind = 'Y')&lt;/FONT&gt;)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;CODE class=" language-sas"&gt;               out = work.etls_sortedxref....&lt;/CODE&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table &lt;EM&gt;etls_sortedxref&lt;/EM&gt; is then used to determine if a source record is new or a change to an already loaded business key. And because the expired record is not in &lt;EM&gt;etls_sortedxref&lt;/EM&gt; the logic determines that&amp;nbsp; it's a new business key and though creates a new value for the retained key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to raise this with SAS TechSupport or shalll I do it?&lt;/P&gt;</description>
      <pubDate>Sun, 08 Sep 2019 04:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Scd-type-2-close-out/m-p/587043#M17953</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-08T04:08:06Z</dc:date>
    </item>
  </channel>
</rss>

