<?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: SQL Pass-Thru vs Proc SQL - Same query has different results in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SQL-Pass-Thru-vs-Proc-SQL-Same-query-has-different-results/m-p/273288#M54445</link>
    <description>&lt;P&gt;It probably has to do with the use of NULL.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options msglevel=i sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which will return how SAS/ACCESS libname will translate your SAS SQL query into Oracle&amp;nbsp;SQL.&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2016 15:11:55 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-05-26T15:11:55Z</dc:date>
    <item>
      <title>SQL Pass-Thru vs Proc SQL - Same query has different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Pass-Thru-vs-Proc-SQL-Same-query-has-different-results/m-p/273269#M54436</link>
      <description>&lt;P&gt;Hi. I've had to change some code from SQL Pass-Thru to Proc SQL and while the Where conditions haven't changed the number of records being pulled has changed to an incorrect number. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL Pass-Thru is pulling directly from the Oracle tables where ACTUAL_DLVRY_DATE is defined as a Date type. &amp;nbsp;Whereas the Proc SQL is referencing an Oracle Libname instead. &amp;nbsp;Can anyone identify what is going wrong and how it can be corrected?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This SQL Pass-Thru code pulls the correct number of records at 341.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	proc sql;
		connect to oracle as db (user=&amp;amp;orauser password=&amp;amp;orapass path="ivasprd");
		create table QueryData as 
		select * from connection to db
		(   select b.imb_code
	            from ivprl.bi_spm_piece_iv_recon a,  ivprl.bi_spm_piece_bids_recon b                                                                                                                                                                                                                                                                                                                                                                                                                                                   
	            where a.imb_code = b.imb_code
	            and A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL
		); 
		disconnect from db;
	quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this Proc SQL code pulls the wrong number of records at 29&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname iv_ora oracle user=&amp;amp;orauser pass=&amp;amp;orapass path="IVASPRD" schema="IVPRL";&lt;BR /&gt;&lt;BR /&gt;	proc sql;
	create table QueryData%sysfunc(tranwrd(&amp;amp;rule_order,.,_)) as 
		select  b.imb_code length = 31
	    from iv_ora.bi_spm_piece_iv_recon a,  iv_ora.bi_spm_piece_bids_recon b                                                                                                                                                                                                                                                                                                                                                                                                                                                   
		where a.imb_code = b.imb_code 
		  and A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL;
	quit;&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;</description>
      <pubDate>Thu, 26 May 2016 14:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Pass-Thru-vs-Proc-SQL-Same-query-has-different-results/m-p/273269#M54436</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-05-26T14:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Pass-Thru vs Proc SQL - Same query has different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SQL-Pass-Thru-vs-Proc-SQL-Same-query-has-different-results/m-p/273288#M54445</link>
      <description>&lt;P&gt;It probably has to do with the use of NULL.&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options msglevel=i sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which will return how SAS/ACCESS libname will translate your SAS SQL query into Oracle&amp;nbsp;SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 15:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SQL-Pass-Thru-vs-Proc-SQL-Same-query-has-different-results/m-p/273288#M54445</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-26T15:11:55Z</dc:date>
    </item>
  </channel>
</rss>

