<?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: Explicit Pass Through SQL Error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449409#M113085</link>
    <description>For that query there's no need for explicit pass through. Use a libname and SAS will translate your datetime constant for you, and pass the WHERE clause to the database.</description>
    <pubDate>Wed, 28 Mar 2018 15:56:25 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2018-03-28T15:56:25Z</dc:date>
    <item>
      <title>Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449315#M113069</link>
      <description>&lt;P&gt;I am trying to submit this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc sql;
connect to odbc as mycon
(datasrc='xxxx' user='xxxx' password='xxxx' BULKLOAD=YES);
create table Table01 AS
select
*
from connection to mycon

(select *
from xxx.REQUEST
where DT_TRAN_CREATED &amp;gt;= "&amp;amp;maxdate"dt);
disconnect from mycon;
quit;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;maxdate is defined as 28MAR2018:14:12:48.00.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run this code I get this error RROR: PROC SQL requires any created table to have at least 1 column.&lt;/P&gt;&lt;P&gt;Any ideas on a solution - Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 28 Mar 2018 13:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449315#M113069</guid>
      <dc:creator>DG1984</dc:creator>
      <dc:date>2018-03-28T13:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449321#M113071</link>
      <description>&lt;P&gt;Your target database does not understand the SAS datetime literal; look at the DB documentation to see how datetime literals are expected to be.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 13:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449321#M113071</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-28T13:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449323#M113072</link>
      <description>&lt;P&gt;Which database are you connecting to? Most databases don't allow double quotes for values.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449323#M113072</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-28T14:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449326#M113073</link>
      <description>&lt;P&gt;I believe you have confused implicit and explicit passthru in your coding.&amp;nbsp; Take a look at my MWSUG paper from a few years ago, &lt;A href="https://www.lexjansen.com/mwsug/2014/SA/MWSUG-2014-SA03.pdf" target="_blank"&gt;https://www.lexjansen.com/mwsug/2014/SA/MWSUG-2014-SA03.pdf&lt;/A&gt; , and try implicit passthru for simpler coding.&amp;nbsp; If you must use explicit passthru, make sure to list your desired columns in the database's own syntax, including datetime format for the database, not SAS DT!&amp;nbsp; Good luck!&lt;/P&gt;&lt;P&gt;Nina L. Werner&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449326#M113073</guid>
      <dc:creator>NinaL</dc:creator>
      <dc:date>2018-03-28T14:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449384#M113082</link>
      <description>&lt;P&gt;Try %TSLIT&lt;/P&gt;
&lt;PRE&gt;where DT_TRAN_CREATED &amp;gt;= %TSLIT(&amp;amp;maxdate));&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 15:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449384#M113082</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-28T15:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449409#M113085</link>
      <description>For that query there's no need for explicit pass through. Use a libname and SAS will translate your datetime constant for you, and pass the WHERE clause to the database.</description>
      <pubDate>Wed, 28 Mar 2018 15:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449409#M113085</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2018-03-28T15:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449455#M113109</link>
      <description>&lt;P&gt;Many thanks - although I get the error below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: CLI cursor fetch error: [Oracle][ODBC][Ora]ORA-01858: a non-numeric character was found where a numeric was expected&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 18:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449455#M113109</guid>
      <dc:creator>DG1984</dc:creator>
      <dc:date>2018-03-28T18:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449480#M113117</link>
      <description>&lt;P&gt;Change you &amp;amp;maxdate macro value to a format Oracle knows like 28-MAR-2018 14:12:48. and in your filter change the Oracle Datetime values to Characters using Oracle function TO_CHAR.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where TO_CHAR(DT_TRAN_CREATED,'DD-MON-YY HH24:MI:SS') &amp;gt;= %TSLIT(&amp;amp;maxdate));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is there any specific reason for using explicit pass-through, instead of Implicit way (Using LIBNAME)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 19:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449480#M113117</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-28T19:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449484#M113119</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185863"&gt;@DG1984&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;You need to convert your date string into something Oracle can understand. Below code worked for me in an actual project.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let maxdate=28MAR2018:14:12:48.00;
%let maxdate_ora=to_date(%unquote(%str(%')&amp;amp;maxdate%str(%')),'DDMONYYYY:HH24:MI:SS');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You then can use above in one of below ways:&lt;/P&gt;
&lt;PRE&gt;where DT_TRAN_CREATED &amp;gt;= &amp;amp;maxdate_ora&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;or..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;where DT_TRAN_CREATED &amp;gt;= to_date(%unquote(%str(%')&amp;amp;maxdate%str(%')),'DDMONYYYY:HH24:MI:SS')&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Mar 2018 20:06:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449484#M113119</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-28T20:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449596#M113163</link>
      <description>&lt;P&gt;Thanks for the paper, I found it online yesterday and found it useful.&amp;nbsp; I am using explicit and not implicit because the tables I am querying have a lot of data and I only want a small section of that data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 08:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449596#M113163</guid>
      <dc:creator>DG1984</dc:creator>
      <dc:date>2018-03-29T08:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449601#M113166</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185863"&gt;@DG1984&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the paper, I found it online yesterday and found it useful.&amp;nbsp; I am using explicit and not implicit because the tables I am querying have a lot of data and I only want a small section of that data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;At least run a test of both methods to verify that explicit PT is needed. You might find that in many/most cases it's not necessary, if you're just doing simple subsets.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 09:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449601#M113166</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-29T09:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Explicit Pass Through SQL Error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449618#M113173</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185863"&gt;@DG1984&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for the paper, I found it online yesterday and found it useful.&amp;nbsp; I am using explicit and not implicit because the tables I am querying have a lot of data and I only want a small section of that data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/185863"&gt;@DG1984&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;The SAS Access engine will try and push as much of the processing to the database as it manages.&lt;/P&gt;
&lt;P&gt;Use the following set of SAS options at the beginning of your code. This will then show you in the log what actually gets executed on the database side and what on the SAS side.&lt;/P&gt;
&lt;PRE&gt;options sastrace=',,,d' sastraceloc=saslog nostsuffix; &lt;/PRE&gt;
&lt;P&gt;For your code here there is a high chance the access engine will be able to fully convert your SQL to the database flavour and though all processing will happen in-database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explicit-Pass-Through-SQL-Error/m-p/449618#M113173</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-29T12:00:11Z</dc:date>
    </item>
  </channel>
</rss>

