<?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: Randomization error occurs while joining unsorted dataset with sorted dataset in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167586#M1867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you _want_ a certain order, you have to _force_ it. If you don't make a determination, then don't expect a certain order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Nov 2014 13:03:28 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2014-11-12T13:03:28Z</dc:date>
    <item>
      <title>Randomization error occurs while joining unsorted dataset with sorted dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167583#M1864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I’m trying to replace the permanent dataset in my code with the data from DB2. Also i'm using SQL pass through to fetch the data from DB2 and creating a work table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this,&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;I’m facing one issue while joining an unsorted dataset with a sorted dataset. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt; : The observation order getting differ in the outputs while joining same set of tables from different locations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Calibri','sans-serif'; font-size: 11pt;"&gt;i.e.&amp;nbsp; &lt;/SPAN&gt;While joining unsorted dataset from a permanent library with sorted dataset and joining unsorted dataset from work library with sorted dataset, the o/ps are different in terms of observation order. And how this observation order affecting is , I'm going to fetch the last observation of each primary key from the above result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us take two tables "EMP" and "DET".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here EMP is sorted table based on Id and DET is unsorted table. The join used herer is&lt;STRONG&gt; LEFT&lt;/STRONG&gt; Join (EMP left join DET).&lt;/P&gt;&lt;P&gt;EMP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="padding-bottom: 0px; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; border: windowtext 1pt solid;" valign="top" width="45"&gt;&lt;P&gt;Id &lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="45"&gt;&lt;P&gt;name&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="45"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="45"&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;DET&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="padding-bottom: 0px; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; border: windowtext 1pt solid;" valign="top" width="41"&gt;&lt;P&gt;Id&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="58"&gt;&lt;P&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="41"&gt;&lt;P&gt;Amt&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="41"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="58"&gt;&lt;P&gt;11/12/2014&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="41"&gt;&lt;P&gt;200&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="41"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="58"&gt;&lt;P&gt;11/12/2014&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="41"&gt;&lt;P&gt;100&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DET in Permanent library and Work Library has the same&amp;nbsp; observation order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output of join: (DET from permanent library).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="padding-bottom: 0px; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; border: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;Id &lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="62"&gt;&lt;P&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;Name&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;Amt&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="62"&gt;&lt;P&gt;11/12/2014&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;200&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="62"&gt;&lt;P&gt;11/12/2014&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="46"&gt;&lt;P&gt;100&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output of join: (DET from work library)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" height="76" style="padding-bottom: 0px; padding-left: 5.4pt; width: 254px; padding-right: 5.4pt; height: 73px; padding-top: 0px;" width="240"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="padding-left: 5.4pt; padding-right: 5.4pt; border: windowtext 1pt solid;" valign="top" width="47"&gt;&lt;P&gt;Id &lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="81"&gt;&lt;P&gt;Date&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="50"&gt;&lt;P&gt;Name&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: windowtext 1pt solid; border-right: windowtext 1pt solid;" valign="top" width="47"&gt;&lt;P&gt;Amt&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="47"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="81"&gt;&lt;P&gt;11/12/2014&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="50"&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="47"&gt;&lt;P&gt;100&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="47"&gt;&lt;P&gt;101&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="81"&gt;&lt;P&gt;11/12/2014&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="50"&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-bottom: windowtext 1pt solid; border-left: medium none; padding-left: 5.4pt; padding-right: 5.4pt; border-top: medium none; border-right: windowtext 1pt solid;" valign="top" width="47"&gt;&lt;P&gt;200&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; In the above o/ps the observation order is different for Amt variable. Beacuse of this I'm getting different o/p in my next step where I'm using last.Id to fetch the last observation from each ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: If I convert the permament dataset to Work dataset then the observation order is matching as like the dataset from DB2. But I want to match the order that I'm getting when using permanent dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me to resolve this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 10:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167583#M1864</guid>
      <dc:creator>ramesh_it</dc:creator>
      <dc:date>2014-11-12T10:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Randomization error occurs while joining unsorted dataset with sorted dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167584#M1865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is your Permanent DET on the database?&amp;nbsp; I am thinking that what is happening is to do with where the code is being executed.&amp;nbsp; The DB2 setup may not need to sort the DET dataset to do the join, however the SAS SQL might add a sort element in (something like an index) to get faster merging. &lt;/P&gt;&lt;P&gt;TBH though I think your logic may also not help.&amp;nbsp; The EMP dataset is a codelist, so you would be better off left joining EMP onto DET, rather than the way you have it currently.&amp;nbsp; It may also remove the need for sorting as the primary dataset would be DET which is unsorted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 11:07:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167584#M1865</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-12T11:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: Randomization error occurs while joining unsorted dataset with sorted dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167585#M1866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No. the permanenet&amp;nbsp; DET is not from database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just used these tables to explain the issue and it is not the exact scenario. Actually more tables are being LEFT joined with the first table and if I change the joining order the business logic would get affected. Also only the columns from the unsorted dataset is not in proper order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for eg.: Take the below queries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;libname perm "&amp;lt;path&amp;gt;";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table output as select * from EMP left join perm.DET on EMP.Id=DET.Id left join &amp;lt;dataset&amp;gt; &amp;lt;conditions&amp;gt;....;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query 2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to db2(&amp;lt;connection string&amp;gt;);&lt;/P&gt;&lt;P&gt;create table DET as select * from connection to db2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ( select * from &amp;lt;schema&amp;gt;.DET);&lt;/P&gt;&lt;P&gt;disconnect from db2;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table output as select * from EMP left join DET on EMP.Id=DET.Id left join &amp;lt;dataset&amp;gt; &amp;lt;conditions&amp;gt;....;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query 3:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname perm "&amp;lt;path&amp;gt;";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data DET;&lt;/P&gt;&lt;P&gt;set perm.DET;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table output as select * from EMP left join DET on EMP.Id=DET.Id left join &amp;lt;dataset&amp;gt; &amp;lt;conditions&amp;gt;....;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;/*********************************************************************************************************/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here &lt;STRONG&gt;query 1&lt;/STRONG&gt;&amp;nbsp; is the actual code and i converted the code as &lt;STRONG&gt;query 2&lt;/STRONG&gt;. But the observation order from the both queries are not same for few columns that are from DET.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I try the &lt;STRONG&gt;query 3&lt;/STRONG&gt;, I'm getting the observation order as &lt;STRONG&gt;query2&lt;/STRONG&gt; and it is perfectly matching for all columns. But this not the case, I want to match the outputs of &lt;STRONG&gt;query 1 and query 2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i think the problem is not in db2, it should be in some other place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 12:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167585#M1866</guid>
      <dc:creator>ramesh_it</dc:creator>
      <dc:date>2014-11-12T12:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Randomization error occurs while joining unsorted dataset with sorted dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167586#M1867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you _want_ a certain order, you have to _force_ it. If you don't make a determination, then don't expect a certain order.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 13:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167586#M1867</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-11-12T13:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Randomization error occurs while joining unsorted dataset with sorted dataset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167587#M1868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add into each of your statements:&lt;/P&gt;&lt;P&gt;proc sql _method _tree;&lt;/P&gt;&lt;P&gt;The above optiosn will show you the elements which are created by the given SQL.&amp;nbsp; What happens behind the scenes is that all tables are looked at in order, indexes are pulled out for fast merging, sorts done etc.&amp;nbsp; Also, have a look at the metadata table - SASHELP.VTABLE for each of the datasets in each event, particularly the variables: indxtype, sortname, sortchar.&amp;nbsp; I.e. try to identify if there is an indicator in the metadata which would suggest to the compiler to use a sort method when it interprets the SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oh, to add, I agree with KurtBremser, you should be specifying a sort in your code, not leaving up to guesswork by the compiler.&amp;nbsp; In the same way, avoid using * in select, it may work, but if tables have the same variables then you don't know what you will end up with.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Nov 2014 13:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Randomization-error-occurs-while-joining-unsorted-dataset-with/m-p/167587#M1868</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-12T13:38:36Z</dc:date>
    </item>
  </channel>
</rss>

