<?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: Oracle data extraction based on TIMESTAMP(6) format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542460#M149890</link>
    <description>&lt;P&gt;It is probably easier to just let SAS do that for you by using implicit SQL instead.&lt;/P&gt;
&lt;P&gt;For example you could create a libref pointing to your oracle table.&lt;/P&gt;
&lt;P&gt;Also with fractional values (floating point numbers) I wouldn't try to use exact matching.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydb oracle ..... ;
data temp;
  set mydb.table ;
  where ctetime between '03MAY2017:13:15:08'dt and '03MAY2017:13:15:09'dt ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 12 Mar 2019 15:44:26 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-03-12T15:44:26Z</dc:date>
    <item>
      <title>Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542360#M149864</link>
      <description>&lt;P&gt;We are trying to extract data from Oracle based DateTime columns. In oracle, we have TIMESTAMP(6) format.&lt;/P&gt;&lt;P&gt;I need to create the same format in sas so that I can extract the oracle data based on DateTime format.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We read the data at sas level its showing data format 27.6 but I am not able to create the format at sas level to filter out Oracle data.&lt;/P&gt;&lt;P&gt;For Example&lt;BR /&gt;Oracle data definition&lt;BR /&gt;Col1 datatype(TIMESTAMP(6)) data values (19-Jul-17 11.12.46.983000000 AM)&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 13:12:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542360#M149864</guid>
      <dc:creator>japsas100</dc:creator>
      <dc:date>2019-03-12T13:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542368#M149866</link>
      <description>&lt;P&gt;Not sure what you question is.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a TIMESTAMP variable in Oracle then it will be converted to a number in SAS with the DATETIME format attached.&lt;/P&gt;
&lt;P&gt;You can use datetime literals if you want to type a specific datetime value into your code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where myvar &amp;gt; '01JAN2019:10:20.123456'dt&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What does the (6) mean in TIMESTAMP(6)? Does that matter at all?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 13:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542368#M149866</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T13:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542388#M149869</link>
      <description>&lt;P&gt;Thanks for the quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract data from Oracle on the datetime column. In Oracle, DateTime column format is&amp;nbsp;TIMESTAMP(6).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my sample code to extract the data from Oracle and&lt;STRONG&gt; its work fine&lt;/STRONG&gt;. my question is how I can define the ''03-MAY-17 01.15.08.214000000 PM'&amp;nbsp; format in sas to create the macro and pass in where condition while extracting the data from Oracle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;%oracle_connect(&amp;amp;rtt);&lt;BR /&gt;create table temp as&lt;BR /&gt;select * from connection to &amp;amp;tt&lt;BR /&gt;(&lt;BR /&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM schema.table&lt;BR /&gt;where TO_CHAR(CTETIME,'DD-MON-RR HH.MI.SS.FF9 AM')= '03-MAY-17 01.15.08.214000000 PM'&lt;BR /&gt;);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542388#M149869</guid>
      <dc:creator>japsas100</dc:creator>
      <dc:date>2019-03-12T14:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542395#M149872</link>
      <description>I still do not see what your question is.&lt;BR /&gt;Are you asking how to pass a datetime value via a macro VARIABLE into your Oracle code?&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542395#M149872</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T14:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542398#M149873</link>
      <description>&lt;P&gt;Yes, I want to create the macro variable in sas equivalent to&amp;nbsp; Oracle&amp;nbsp;&amp;nbsp;TIMESTAMP(6) format.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:16:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542398#M149873</guid>
      <dc:creator>japsas100</dc:creator>
      <dc:date>2019-03-12T14:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542404#M149874</link>
      <description>&lt;P&gt;The tricky thing with passing values into remote database is that most require the use of single quotes around strings and in SAS the single quotes prevent the expansion of macro variables.&amp;nbsp; Here is one method to get the single quotes added.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dt=03MAY2017:13:15:08.214;
%let dt=%unquote(%bquote('&amp;amp;dt'));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since your sample code is already using the Oracle function TO_CHAR() to convert the timestamp into a string why not just modify the format string you are passing to it to use a format that works better for strings formatted by SAS?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542404#M149874</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T14:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542408#M149875</link>
      <description>&lt;P&gt;It's not working fine.. here is an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: ORACLE PREPARE ERROR: ORA-00933: SQL command not properly ended. SQL STATEMENT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542408#M149875</guid>
      <dc:creator>japsas100</dc:creator>
      <dc:date>2019-03-12T14:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542411#M149876</link>
      <description>&lt;P&gt;Show enough of the SAS log so we can see what code you tried and exactly what statements are causing the error.&lt;/P&gt;
&lt;P&gt;Make sure to use the {i} button on the editor menu to open a pop to paste in the text. That will prevent the forum editor from mangling the formatting.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542411#M149876</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T14:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542414#M149877</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;My objective is to create the below format in sas dataset then pass the value in where clause.&lt;/P&gt;&lt;P&gt;'03-MAY-17 01.15.08.214000000 PM' : This data I copied from Oracle column&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How I can create the above format in the sas data step.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542414#M149877</guid>
      <dc:creator>japsas100</dc:creator>
      <dc:date>2019-03-12T14:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542417#M149878</link>
      <description>Why would you want that particular format? It is missing the century part of the year. It is using am/pm instead of 24 hour clock.&lt;BR /&gt;If you really want to create that then look at using custom picture format.&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Mar 2019 14:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542417#M149878</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T14:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542430#M149882</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to extract the data from Oracle based on DateTime .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just want to check which is the approach to pull the data from Oracle based on below scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oracle table(Data_Type TIMESTAMP(6))&lt;/P&gt;&lt;P&gt;Column1&lt;/P&gt;&lt;P&gt;01-JUN-17 10.07.18.631000000 AM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We need to create the sas table by passing the DateTime value at sas level.&amp;nbsp; We need to include the milliseconds in time so that we will not extract the same data again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 15:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542430#M149882</guid>
      <dc:creator>japsas100</dc:creator>
      <dc:date>2019-03-12T15:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542457#M149889</link>
      <description>&lt;P&gt;Still not sure why you are using such a goofy format since you could just change the FORMAT string in Oracle so that your Oracle code could use a different character representation of the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is definition of a SAS format to display datatime values into that style.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture xxdt
  low-high = '%0d-%b-%0y %0I.%0M.%0s %p' (datatype=datetime)
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that SAS will only display 6 places for the fractional seconds.&lt;/P&gt;
&lt;PRE&gt;639   %let dt=%sysfunc(datetime(),xxdt28.6);
640   %let qdt=%sysfunc(quote(&amp;amp;dt,%str(%')));
641   %put &amp;amp;=dt &amp;amp;=qdt;
DT=12-MAR-19 11.38.16.303000 AM QDT='12-MAR-19 11.38.16.303000 AM'
&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2019 15:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542457#M149889</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T15:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle data extraction based on TIMESTAMP(6) format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542460#M149890</link>
      <description>&lt;P&gt;It is probably easier to just let SAS do that for you by using implicit SQL instead.&lt;/P&gt;
&lt;P&gt;For example you could create a libref pointing to your oracle table.&lt;/P&gt;
&lt;P&gt;Also with fractional values (floating point numbers) I wouldn't try to use exact matching.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mydb oracle ..... ;
data temp;
  set mydb.table ;
  where ctetime between '03MAY2017:13:15:08'dt and '03MAY2017:13:15:09'dt ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Mar 2019 15:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-data-extraction-based-on-TIMESTAMP-6-format/m-p/542460#M149890</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-12T15:44:26Z</dc:date>
    </item>
  </channel>
</rss>

