<?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: SCD2 Sort Failing w/ non A-Z 0-9 in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454731#M14038</link>
    <description>&lt;P&gt;As I recall, we had similar issues with SQL Server, not sure if it was in the SCD Type 2 loader specifically.&lt;/P&gt;
&lt;P&gt;But please attach your log so it's easier for us to pinpoint the problem.&lt;/P&gt;
&lt;P&gt;You could of course force the libname engine not to pust sorts t the target, but that could impact performance.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 13:38:38 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2018-04-17T13:38:38Z</dc:date>
    <item>
      <title>SCD2 Sort Failing w/ non A-Z 0-9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454059#M14011</link>
      <description>&lt;P&gt;We are attempting to maintain history with an SCD2 node loading to a SQL Server table. The Business Key occasionally contains characters other than A-Z and 0-9 at the beginning. When I load the table from empty, it loads fine. When I attempt to run a delta I get "ERROR: BY variables are not properly sorted on data set&amp;nbsp;". It is referring too the data that was sourced from the Target table for reference. If I remove the non A-Z &amp;amp; 0-9 it all works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is stored in the SQL Server Table ordered by the Business Key and I sort the data by Business Key just before the SCD2. Could one sort method put the odd characters at the bottom and the other at the top? Maybe I need to apply a different SORTSEQ somehow? Any insight would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 20:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454059#M14011</guid>
      <dc:creator>jdebru</dc:creator>
      <dc:date>2018-04-13T20:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: SCD2 Sort Failing w/ non A-Z 0-9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454563#M14021</link>
      <description>&lt;P&gt;I guess it is because the sorting is done in the DBMS and collating sequence of the DBMS sort is different from the way SAS sorts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a workaround you can&amp;nbsp;tell the DBMS to use a different sort sequence.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a code sample from Oracle, maybe there is a similar way to do it for your DBMS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydbms&lt;BR /&gt; oracle&lt;BR /&gt; path=xe&lt;BR /&gt; user="uid" password="pw"&lt;BR /&gt; dbconinit="alter session set nls_sort = binary "&lt;BR /&gt;;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The&amp;nbsp;information&amp;nbsp;specified for the dbconinit option can also be set under the advanced properties of the library metadata object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can test whether it works, by running&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;&lt;BR /&gt;  set mydbms.dbtable;&lt;BR /&gt;  by col_with_special_chars;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 20:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454563#M14021</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2018-04-16T20:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: SCD2 Sort Failing w/ non A-Z 0-9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454589#M14026</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/204339"&gt;@jdebru&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Why do you have to pre-sort in first place? Looking into SCD2 transformation generated code I can see explicit sorts in the generated code. But then my sample code will not reflect exactly what you're having.&lt;/P&gt;
&lt;P&gt;It would be interesting to understand which step in your code exactly is throwing the error and why no generated pre-sorting is happening there (i.e. do you pass in your source table with a &lt;EM&gt;sorteby&lt;/EM&gt; attribute set?).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;....and last but not least: I'm not a big fan of the SCD2 transformation when it comes to using it with a target table in a database (too much data movement to SAS with huge impact on performance). You can also load SCD2 with a rather simple combination of a SQL Update and SQL Insert. If your source table resides in SAS then first upload this table into a staging table and then execute everything in-database. There is no need to spend time creating a hash key using md5()&amp;nbsp;but make sure you've got an index on the target table over the business key.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 22:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454589#M14026</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-04-16T22:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: SCD2 Sort Failing w/ non A-Z 0-9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454721#M14036</link>
      <description>&lt;P&gt;Thank you for the responses Bruno &amp;amp; Patrick! I am not imposing a sort on the target table. There does not appear to be an option to do so. We are working with SQL Server, so I will check the syntax on performing such a change to the sorting of the target in the&amp;nbsp;DB. Initially we did not impose any sorting at all until we received the error. We are using the out of the box functionality in DI Studio. I am trying to stay away from any "custom" SAS code. Building out the SCD2 functionality manually is my last resort. The SCD2 node should be sufficient for our use case. I will check the sorting options and report back with my findings! Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 12:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454721#M14036</guid>
      <dc:creator>jdebru</dc:creator>
      <dc:date>2018-04-17T12:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: SCD2 Sort Failing w/ non A-Z 0-9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454731#M14038</link>
      <description>&lt;P&gt;As I recall, we had similar issues with SQL Server, not sure if it was in the SCD Type 2 loader specifically.&lt;/P&gt;
&lt;P&gt;But please attach your log so it's easier for us to pinpoint the problem.&lt;/P&gt;
&lt;P&gt;You could of course force the libname engine not to pust sorts t the target, but that could impact performance.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 13:38:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SCD2-Sort-Failing-w-non-A-Z-0-9/m-p/454731#M14038</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-04-17T13:38:38Z</dc:date>
    </item>
  </channel>
</rss>

