<?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 Statement not processing in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193407#M48564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#p00m0fdlbdu781n1jxsn4umlqyok.htm#n0vtpo1d9es6zon1rhxqj2go918o" title="http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#p00m0fdlbdu781n1jxsn4umlqyok.htm#n0vtpo1d9es6zon1rhxqj2go918o"&gt;SAS(R) 9.4 SQL Procedure User's Guide&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 May 2015 17:54:27 GMT</pubDate>
    <dc:creator>Doc_Duke</dc:creator>
    <dc:date>2015-05-27T17:54:27Z</dc:date>
    <item>
      <title>SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193401#M48558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a PROC SQL that runs a Connection to Oracle. If I run this SQL statement in a SQL-specific program, the code runs just fine. However, I get an "Invalid SQL Statement" error when I run it in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;In attempting to diagnose why, I copy/pasted the block of SQL from the SAS log and tried to run it that way, thinking the formatting of the code itself might have something to do with it. It looks like it does; when I run what the SAS log produces (I am assuming this is how SAS itself processes it), the SQL program produces the same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this an accurate conclusion? Also, if this is the case, is there a way to prevent that from happening?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 20:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193401#M48558</guid>
      <dc:creator>kgot</dc:creator>
      <dc:date>2015-05-26T20:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193402#M48559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most likely you need to run the SQL statement in a SAS SQL pass-through step as it may contain Oracle-specific syntax. Please code your code so we can advise further.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 May 2015 21:35:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193402#M48559</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-05-26T21:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193403#M48560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree any code would be helpful, anytime you are passing through to any other environment there can be different nuances in how things should be written.&amp;nbsp; Teradata case statements always throw me off.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 11:09:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193403#M48560</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-05-27T11:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193404#M48561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The issue came in where I had multiple nested and/or statements in the WHERE clause. This is essentially what the statement in question looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x.rownum=1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and((X.nbr_fld=123456 and X.dt_fld&amp;gt;='02-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=234567 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='02-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=345678 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='02-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=111222 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='02-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=222333 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='02-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=123123 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='03-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=321321 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='03-SEP-2014')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; or (X.&lt;SPAN style="font-size: 13.3333330154419px;"&gt;nbr_fld&lt;/SPAN&gt;=432432 and &lt;SPAN style="font-size: 13.3333330154419px;"&gt;X.dt_fld&lt;/SPAN&gt;&amp;gt;='03-SEP-2014') ..... )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because of the nature of the data I am working with, I have a number of these clauses (745, to be exact). Also, each date is particular to each serial number, so I am not sure if I could "hard code" any of these dates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 17:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193404#M48561</guid>
      <dc:creator>kgot</dc:creator>
      <dc:date>2015-05-27T17:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193405#M48562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The '02-sep-2014' is Oracle specific.&amp;nbsp; You need to follows SASKiwi's advice and use the pass-thru facility.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 17:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193405#M48562</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2015-05-27T17:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193406#M48563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Doc! I am very new to SAS, and I do not believe I have used the pass-thru facility--what do you mean by that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 17:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193406#M48563</guid>
      <dc:creator>kgot</dc:creator>
      <dc:date>2015-05-27T17:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193407#M48564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#p00m0fdlbdu781n1jxsn4umlqyok.htm#n0vtpo1d9es6zon1rhxqj2go918o" title="http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#p00m0fdlbdu781n1jxsn4umlqyok.htm#n0vtpo1d9es6zon1rhxqj2go918o"&gt;SAS(R) 9.4 SQL Procedure User's Guide&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 17:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193407#M48564</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2015-05-27T17:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Statement not processing</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193408#M48565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it! I was using pass-through logic already, so I looked further into the code to see if there was something I missed. Turns out there was.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue ended up being some commenting that I had in SQL using the "--" syntax. Since it seems SAS was processing the SQL statement as a block of text (instead of the line-by-line formatting I had), it was including some additional lines in the comment that I was not expecting. I took those parts out, and now it works just fine. Thank you Doc, Mark, and SASKiwi for helping me to get to the bottom of this!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 May 2015 19:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Statement-not-processing/m-p/193408#M48565</guid>
      <dc:creator>kgot</dc:creator>
      <dc:date>2015-05-27T19:19:29Z</dc:date>
    </item>
  </channel>
</rss>

