<?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: How to convert hh:mm:ss from a SAS dataset to an Oracle Table in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916876#M44325</link>
    <description>&lt;P&gt;&lt;EM&gt;"In my SAS dataset, the content of the variable&amp;nbsp;HRDEBTRA look like : 14:50:05"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SAS stores time and datetime values in a numerical variable as count of seconds. It's then the format attached to the variable that determines how this count of second gets displayed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It looks like your variable only stores a time value - which is just a count of seconds.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In Oracle you normally store such data as a datetime value for which there are two data types: datetime and timestamp.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The easiest way to prepare your SAS data for loading into Oracle would be to convert your SAS Time value to a SAS DateTime value. That's not hard to do IF you know the calendar date that would match the time portion you've already got.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;On the SAS side: Could you convert&amp;nbsp;14:50:05 to something like&amp;nbsp;02Jan2024:14:50:05 ? Do you have this date information somewhere in your data?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2024 23:07:29 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-02-19T23:07:29Z</dc:date>
    <item>
      <title>How to convert hh:mm:ss from a SAS dataset to an Oracle Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916869#M44324</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my SAS dataset, the content of the variable&amp;nbsp;HRDEBTRA look like : 14:50:05&lt;/P&gt;
&lt;P&gt;Then if the Oracle table does not exist, I am using a proc append&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc append base=&amp;amp;libref..&amp;amp;table_name data=&amp;amp;table_name;
run;

where &amp;amp;libref is the name of the oracle schema, and table_name is the table name (target table)

work.&amp;amp;table_name (source table)

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;if the Oracle table exist the we update the table using the script below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options sastrace=',,;d' sastraceloc=saslog nostsuffix; 
proc sql;
connect to oracle (AUTHDOMAIN=ORACLE_&amp;amp;OWNER._&amp;amp;Database. PATH=&amp;amp;Database. readbuff=1000);
execute(
MERGE INTO &amp;amp;schema..&amp;amp;TblName1. pt 
USING &amp;amp;SCHEMA..&amp;amp;TblName2. ps 
ON    (pt.recordId = ps.recordId) 
WHEN NOT MATCHED THEN INSERT VALUES
(&amp;amp;varlist1.)
WHEN MATCHED THEN UPDATE 
  SET 
  &amp;amp;varlist2.
) BY ORACLE;
DISCONNECT FROM ORACLE;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, the variable&amp;nbsp;HRDEBTRA in the Oracle table is like a date.&lt;/P&gt;
&lt;P&gt;What's the best way to convert that funzy date to HH24:mm:ss ex: 14:50:05&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2/1/2024 2:50:05 PM&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 21:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916869#M44324</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-02-19T21:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert hh:mm:ss from a SAS dataset to an Oracle Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916876#M44325</link>
      <description>&lt;P&gt;&lt;EM&gt;"In my SAS dataset, the content of the variable&amp;nbsp;HRDEBTRA look like : 14:50:05"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SAS stores time and datetime values in a numerical variable as count of seconds. It's then the format attached to the variable that determines how this count of second gets displayed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It looks like your variable only stores a time value - which is just a count of seconds.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In Oracle you normally store such data as a datetime value for which there are two data types: datetime and timestamp.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The easiest way to prepare your SAS data for loading into Oracle would be to convert your SAS Time value to a SAS DateTime value. That's not hard to do IF you know the calendar date that would match the time portion you've already got.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;On the SAS side: Could you convert&amp;nbsp;14:50:05 to something like&amp;nbsp;02Jan2024:14:50:05 ? Do you have this date information somewhere in your data?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 23:07:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916876#M44325</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-02-19T23:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert hh:mm:ss from a SAS dataset to an Oracle Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916976#M44330</link>
      <description>&lt;P&gt;No, 2/1/2024 , I dont' know where does come from this date ?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 14:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/916976#M44330</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-02-20T14:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert hh:mm:ss from a SAS dataset to an Oracle Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/917035#M44332</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Oracle date is actually datetime value.&amp;nbsp; There is no specific time variable AFAIK in Oracle.&lt;BR /&gt;If it is required to store only time values OR if the variable holds only time, then the appropriate approach would be to either&amp;nbsp; convert the time to a number (for example number of seconds since midnight- the default SAS storage for time) &lt;STRONG&gt;OR&amp;nbsp;&lt;/STRONG&gt;to save time as a character string (thus&amp;nbsp;&lt;SPAN&gt;14:50:05 would be '14:50:05') and pass the string to ORACLE.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 18:59:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/917035#M44332</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2024-02-20T18:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert hh:mm:ss from a SAS dataset to an Oracle Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/917040#M44333</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76331"&gt;@alepage&lt;/a&gt;&amp;nbsp; - If you are required to update an Oracle datatime column, then you have no choice but to add a date to your time value. If you don't know what date needs to be supplied then ask your Oracle administrator or someone knowledgeable about the table contents for advice.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 19:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-convert-hh-mm-ss-from-a-SAS-dataset-to-an-Oracle-Table/m-p/917040#M44333</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-02-20T19:10:22Z</dc:date>
    </item>
  </channel>
</rss>

