<?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: SAS Oracle where clause on date variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323814#M71830</link>
    <description>&lt;P&gt;It has to be valid SQL syntax for your server, which it isn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace the macro variable with the value to see what you need to do, possibly include quotes?&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2017 23:15:44 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-01-10T23:15:44Z</dc:date>
    <item>
      <title>SAS Oracle where clause on date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323809#M71828</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to subset oracle dataset on date variable which is &lt;STRONG&gt;numeric and has sas format datetime27.6.&lt;/STRONG&gt; for eg. it looks like: 01JAN1960:13:01:01.000000&lt;/P&gt;&lt;P&gt;attached is what i have my code currently..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting error with following query. Please advice correct way of using datetime subset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13314iF0727324F5985683/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;</description>
      <pubDate>Tue, 10 Jan 2017 23:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323809#M71828</guid>
      <dc:creator>ArseneWenger</dc:creator>
      <dc:date>2017-01-10T23:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Oracle where clause on date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323814#M71830</link>
      <description>&lt;P&gt;It has to be valid SQL syntax for your server, which it isn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace the macro variable with the value to see what you need to do, possibly include quotes?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 23:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323814#M71830</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-10T23:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Oracle where clause on date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323815#M71831</link>
      <description>&lt;P&gt;EDIT: I'd post the modification to show but I don't want to type out your code. Post as text in the future please.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 23:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323815#M71831</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-10T23:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Oracle where clause on date variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323838#M71839</link>
      <description>&lt;P&gt;Your macro variable &amp;amp;my_date must resolve to something like:&amp;nbsp;'11JAN2017:12:34:57'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at picture you've posted, I believe you're missing the single quotes around the date string and the column between yyyy and HH24.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh... and reading your initial post again, I also come to realize that you're applying a SAS DateTime format on a SAS Date value. That's why you end up with a year of 1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I am trying to subset oracle dataset on date variable which is &lt;STRONG&gt;numeric and has sas format datetime27.6.&lt;/STRONG&gt; for eg. it looks like: 01JAN1960:13:01:01.000000&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the SAS side: Use format DATE9. &amp;nbsp;This will give you a string like 11JAN2017&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On the Oracle side use something like:&lt;/P&gt;
&lt;P&gt;where trunc(e.timestamp,'DATE') &amp;gt; to_date(&amp;amp;my_date,'ddmonyyyy') &amp;nbsp;&lt;/P&gt;
&lt;P&gt;....don't forget to wrap the single quotes around the date string value!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.oracle.com/cd/E29805_01/server.230/es_eql/src/cdfp_analytics_lang_trunc.html" target="_blank"&gt;https://docs.oracle.com/cd/E29805_01/server.230/es_eql/src/cdfp_analytics_lang_trunc.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And last but not least:&lt;/P&gt;
&lt;P&gt;When using SQL pass-through then I'd always first use a native database client to develop the code (i.e. SQL Developer). Only when the code works copy paste it into a SAS pass-through block and add your customizations like SAS macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2017 01:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Oracle-where-clause-on-date-variable/m-p/323838#M71839</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-01-11T01:51:13Z</dc:date>
    </item>
  </channel>
</rss>

