<?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: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213642#M39452</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe @Tom is "spot on". You must be using Oracle pass-through SQL as else we wouldn't get this kind of Oracle error back. The way you populate the macro var and the format picture I believe the following should work (in pass-through SQL):&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;to_date(&amp;amp;yearmoThru.,'yyyymmdd')&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jul 2015 09:42:29 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2015-07-30T09:42:29Z</dc:date>
    <item>
      <title>ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213636#M39446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;I am getting ORA-01830 error while running the below code. I have defined the Yearfrom and Yearthru in my macro. I tried inputting my date with single quote and without it. But same error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;Does anyone know what it is? Any insights would be helpful.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;%let yearmoFrom = '20150601';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;%let yearmoThru = '20150630';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc SQL;&lt;/P&gt;&lt;P&gt;Create table one as&lt;/P&gt;&lt;P&gt;select a, b, c,d&lt;/P&gt;&lt;P&gt;from data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; where EFF_DT &amp;lt;= to_date(&amp;amp;yearmoThru. || '15','yyyymmdd')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and elg.MBR_TRMNTN_DT&amp;nbsp; &amp;gt;= to_date(&amp;amp;yearmoFrom. || '15','yyyymmdd')&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 19:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213636#M39446</guid>
      <dc:creator>skallamp</dc:creator>
      <dc:date>2015-07-29T19:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213637#M39447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this code: &amp;amp;yearmoThru. || '15'&amp;nbsp; looks like would be attempting to&amp;nbsp; generate 2015063015 (ignoring all quotes)&lt;/P&gt;&lt;P&gt;This does not look like any match to yyymmdd&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 12pt;"&gt;%let yearmoThru = 201506;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 12pt;"&gt;for the same value should generate 20150615, which makes a bit more sense.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 20:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213637#M39447</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-07-29T20:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213638#M39448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you have written SAS code (not ORACLE code) you cannot use TO_DATE() function.&lt;/P&gt;&lt;P&gt;Let's assume that you actually submitted that code to ORACLE in a pass thru SQL query.&lt;/P&gt;&lt;P&gt;Since your macro variables already contain 8 digits (20150601) when you are append two more ( || '15') you will have string that is 10 characters long.&amp;nbsp; But your format string ('yyymmdd') is only 8 characters long.&amp;nbsp; That is why you are getting the error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either remove the || '15' or assign only 6 digits to the macro variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Jul 2015 22:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213638#M39448</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-29T22:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213639#M39449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the generate Oracle SQL. You are getting an Oracle error. TO_Date is an SAS function an a Oracle function it should be translated &lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/68028/HTML/default/viewer.htm#p0f64yzzxbsg8un1uwgstc6fivjd.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/68028/HTML/default/viewer.htm#p0f64yzzxbsg8un1uwgstc6fivjd.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Seventh Edition&lt;/A&gt; There is a warning associated with that.&amp;nbsp; &lt;/P&gt;&lt;P&gt;A more common pitfall is that Oracle is only knowing data-time approaches not the segregated date as SAS does.&lt;A href="http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions183.htm" title="http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions183.htm"&gt;TO_DATE&lt;/A&gt; (Oracle)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 06:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213639#M39449</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-07-30T06:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213640#M39450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Jaap&lt;/P&gt;&lt;P&gt;I wanted to write "to_date()" is not a SAS function. But then I checked just in case and actually the function exists as part of DS2 syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT: to_date() is not a valid SAS function outside of DS2 so you can't use it with SAS SQL flavor. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 07:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213640#M39450</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-07-30T07:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213641#M39451</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;I thin you need to clarify your post.&amp;nbsp; Exactly where are you running this code.&amp;nbsp; If it is SAS SQL, then how are you getting an oracle error?&amp;nbsp; TO_DATE() is a valid Oracle function as described: &lt;A href="http://www.techonthenet.com/oracle/functions/to_date.php" title="http://www.techonthenet.com/oracle/functions/to_date.php"&gt;http://www.techonthenet.com/oracle/functions/to_date.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;However to use that function, you need to pass your code through to the Oracle SQL parser (note you also need to place the macro variable in quotes so it gets resolved) - Note I assume the macro variable to look like 201504:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connect to oracle (path=...);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; line-height: 1.5em; background-color: #ffffff;"&gt; ONE as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; line-height: 1.5em; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select * from connection to oracle (&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp;&amp;nbsp; A,B,C,D&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATA&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where&amp;nbsp;&amp;nbsp; EFF_DT &amp;lt;= to_date("&amp;amp;yearmoThru." || '15','yyyymmdd')&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&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; and&amp;nbsp;&amp;nbsp; elg.MBR_TRMNTN_DT&amp;nbsp; &amp;gt;= to_date("&amp;amp;yearmoFrom." || '15','yyyymmdd'));&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'Courier New'; font-size: 12pt; font-style: inherit; font-weight: inherit; line-height: 1.5em;"&gt;&amp;nbsp; disconnect from oracle;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 08:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213641#M39451</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-07-30T08:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213642#M39452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe @Tom is "spot on". You must be using Oracle pass-through SQL as else we wouldn't get this kind of Oracle error back. The way you populate the macro var and the format picture I believe the following should work (in pass-through SQL):&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;to_date(&amp;amp;yearmoThru.,'yyyymmdd')&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213642#M39452</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-07-30T09:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: ORACLE execute error: ORA-01830: date format picture ends before converting entire input string.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213643#M39453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick, you are right the to_date fucntion is no sas function.&lt;/P&gt;&lt;P&gt;Sorry I forgot&amp;nbsp; to check that one, you got me on that one. I got my head into DS2 but the strict language checkng I prefer to leave to the compiler not my head.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rw9 made the clarification for that. (Sql pass through).&amp;nbsp;&amp;nbsp;&amp;nbsp; His reference to the oracle to_date function.&lt;/P&gt;&lt;P&gt;Some alerts:&lt;/P&gt;&lt;P&gt;- The double quotes is not valid withn ansi SQL for strings. The double quoates are for names using enhanced lterals and strings are only processed wiht singel quotes.&lt;/P&gt;&lt;P&gt;&amp;nbsp; That is mostly complicating the macro-var coding. Adding single quotes as one char is done with coding (a macro quoting challenge):&amp;nbsp; %nrstr(%')&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;- The concatenation of strings OP original post, is something that looks from the sas-datastep processing. That will not work in sas-macro processing and not work in Oracle SQL.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:59:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-ORACLE-execute-error-ORA-01830-date-format-picture-ends/m-p/213643#M39453</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-07-30T09:59:39Z</dc:date>
    </item>
  </channel>
</rss>

