<?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: Determine if a variable contains a SAS date value (part 2) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158013#M30869</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Time is a measurement. It is impossible to get back just from some digits to what the measurement is about and what the unit are.&lt;/P&gt;&lt;P&gt;liters gallons kilometer inches knots m/s kilos mol (etc.). To make it worse with time measurements it is the most badly disturbed one by social history. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 08 Feb 2015 16:13:54 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2015-02-08T16:13:54Z</dc:date>
    <item>
      <title>Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158006#M30862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a follow up from &lt;A __default_attr="65214" __jive_macro_name="thread" class="jive_macro jive_macro_thread" href="https://communities.sas.com/"&gt;&lt;/A&gt; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; where I was looking for a programmatic way to determine if a format is time, date or datetime related. Apparently there is no hidden gem in the SAS provided software to easily get such an answer. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Attached is some code which creates such a format grouping for Gregorian time, date &amp;amp; datetime formats. If this is something of interest to someone else then what I would like to get is some feedback/quality checking if I've got this right or if there are formats in the wrong group (only SAS provided formats).&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 06:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158006#M30862</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-08T06:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158007#M30863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick,&lt;/P&gt;&lt;P&gt;Well Done. Hope one day I could use it . But I still encourage you to ask SAS to build&amp;nbsp; functions&amp;nbsp; isDate() isDateTime() isTime() , that would be very convenient for SAS users. Because&amp;nbsp; You also need to consider another scenario :&amp;nbsp; someone create a new Date format by proc format + picture , what you are going to do ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 07:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158007#M30863</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-02-08T07:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158008#M30864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Xia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I might propose some function like SASfmtgroup() and hope you're going then to vote this up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have an idea of how to deal with user implemented formats so that it's always going to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need this format grouping for:&lt;/P&gt;&lt;P&gt;I have to implement a process which takes a SAS table as input and writes an XML as output. The XML has pre-defined output formats for time, date &amp;amp; datetime values. I'm happy if can fully automate for SAS provided formats and then provide an input parameter where a user can define additional variables as containing time, date or datetime values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 08:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158008#M30864</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-08T08:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158009#M30865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;"I might propose some function like SASfmtgroup() and hope you're going then to vote this up."&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I don't know if I would vote.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;"I don't have an idea of how to deal with user implemented formats so that it's always going to work."&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I believe SAS has such ability .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 09:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158009#M30865</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-02-08T09:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158010#M30866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;I believe SAS has such ability&lt;/SPAN&gt;"&lt;/P&gt;&lt;P&gt;How? Can you please explain? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only idea I had so far was to apply the user written format and then test if I can read the string using SAS informats. But that's certainly not going to work in all cases.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 09:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158010#M30866</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-08T09:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158011#M30867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I mean the people who born the SAS . i.e. the developers who build the SAS .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 09:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158011#M30867</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-02-08T09:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158012#M30868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS Data step 2 (Proc DS2) has more data types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With "standard" SAS it could be quite a daunting task to come up with a 100% solution for such a format grouping. With picture formats there should be a way to determine the groups via the datatype control attribute (if only one type used in a format) - but one can also use a function as part of a format definition and I don't see how this could be covered (even by SAS R&amp;amp;D).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 11:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158012#M30868</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-08T11:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158013#M30869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Time is a measurement. It is impossible to get back just from some digits to what the measurement is about and what the unit are.&lt;/P&gt;&lt;P&gt;liters gallons kilometer inches knots m/s kilos mol (etc.). To make it worse with time measurements it is the most badly disturbed one by social history. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Feb 2015 16:13:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158013#M30869</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-02-08T16:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158014#M30870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code from the Characterize task in SAS UE is interesting. It looks like it creates macro variables of the most commonly used date/time formats and uses that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="10185" __jive_macro_name="document" class="jive_macro jive_macro_document" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 02:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158014#M30870</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-12T02:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158015#M30871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="255172" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/"&gt;&lt;/A&gt; Thank you for this link. Really interesting that even in SAS Studio some developer needed to specifically code for these formats.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where it also would be VERY helpful imho to have such "date format detection" deeper integrated into the SAS language would be for the SAS/Access engines so that "SASDATEFMT" and "DBSASTYPE" would only be required for user defined formats.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I'm designing right now for such a case with at least 30 date related SAS variables&lt;SPAN style="font-size: 13.3333330154419px;"&gt; using ISO formats&lt;/SPAN&gt; to be loaded into Oracle.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 09:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158015#M30871</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-12T09:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158016#M30872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think your or someone else's suggestion of a format category or vtypecategory function is valid, and would upvote such an idea. &lt;/P&gt;&lt;P&gt;If I could find it among all the spam. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 09:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158016#M30872</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-12T09:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158017#M30873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="255172" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;LOL - I'll wait a few days then before I post such an idea.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 10:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158017#M30873</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-12T10:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158018#M30874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="8872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The "only thing" I would like is to get access to some SAS implemented format grouping for SAS provided formats. I agree that a date format applied to a numeric SAS variable doesn't necessarily mean that a SAS date value is stored in this variable. I would be more than happy though for SAS to work/behave with such an assumption so that I would only have to code for the very special cases where this is not true (can't think of any though).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2015 10:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158018#M30874</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-12T10:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158019#M30875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick the documentation &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm" title="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt; is organized by categories.&lt;/P&gt;&lt;P&gt;The SAS/ACCES module does not mention an Oracel ISO datetime type there are only Oracle internal timestamps. Looking at Oracle &lt;A href="http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions192.htm#SQLRF06133" title="http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions192.htm#SQLRF06133"&gt;TO_DSINTERVAL&lt;/A&gt; there is a conversion form internal timestamp to an ISO format (character string) vice versa. As you are saying to convert internal to ISO on both sides I am seeing some unnecessary complication with that approach. Of course you could make the design statement that no advance oought interfaces may be used only data exchange by the means of text-files am uild it all by yourself. But what is the business case of this.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2015 08:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158019#M30875</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-02-13T08:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158020#M30876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="8872" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; Yes, I know that the documentation categorizes formats - but this information is nowhere accessible from within a SAS program and it appears it is also not fully used by the SAS/Access engines. So if we need some automatic detection if a SAS variable contains a date, time or datetime value (derived from the format applied to this SAS variable) then we need to code for this - and it appears that such coding has even been done within SAS Studio as &lt;A __default_attr="255172" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;'s example demonstrates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In regards of the SAS/Access engine to Oracle have a look into below example and what goes wrong there. I know how to solve it but it requires explicit coding (using options &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;"SASDATEFMT" and "DBSASTYPE"). What I would like is that the Access engine would detect this automatically based on formats and convert them. I understand that SAS couldn't just change defaults - but something like an option for extended format recognition would serve the purpose as well.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;/P&gt;&lt;P&gt;data work.sastable;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format d_date9 date9. dt_datetime20 datetime20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format d_b8601da b8601da. dt_b8601dt b8601dt. dt_datetime21 datetime21.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; d_date9=date();d_b8601da=date();&lt;/P&gt;&lt;P&gt;&amp;nbsp; dt_datetime20=datetime();dt_b8601dt=datetime();dt_datetime21=datetime();&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc append base=oradb.oratable data=work.sastable;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc append base=oradb.oratable data=work.sastable;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And here the log&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; options sastrace=',,,d' sastraceloc=saslog nostsuffix;&lt;/P&gt;&lt;P&gt;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data work.sastable;&lt;/P&gt;&lt;P&gt;29&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format d_date9 date9. dt_datetime20 datetime20.;&lt;/P&gt;&lt;P&gt;30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format d_b8601da b8601da. dt_b8601dt b8601dt. dt_datetime21 datetime21.;&lt;/P&gt;&lt;P&gt;31&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d_date9=date();d_b8601da=date();&lt;/P&gt;&lt;P&gt;32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt_datetime20=datetime();dt_b8601dt=datetime();dt_datetime21=datetime();&lt;/P&gt;&lt;P&gt;33&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;34&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.SASTABLE has 1 observations and 5 variables.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;36&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_9: Prepared: on connection 2&lt;/P&gt;&lt;P&gt;SELECT * FROM oradb.ORATABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_10: Prepared: on connection 2&lt;/P&gt;&lt;P&gt;SELECT * FROM oradb.ORATABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;37&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc append base=oradb.oratable data=work.sastable;&lt;/P&gt;&lt;P&gt;38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Appending WORK.SASTABLE to ORADB.ORATABLE.&lt;/P&gt;&lt;P&gt;NOTE: BASE data set does not exist. DATA file is being copied to BASE file.&lt;/P&gt;&lt;P&gt;NOTE: SAS variable labels, formats, and lengths are not written to DBMS tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_11: Executed: on connection 3&lt;/P&gt;&lt;P&gt;CREATE TABLE oradb.ORATABLE(d_date9 DATE,dt_datetime20 DATE,d_b8601da DATE,dt_b8601dt DATE,dt_datetime21 DATE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_12: Prepared: on connection 3&lt;/P&gt;&lt;P&gt;INSERT&amp;nbsp; INTO oradb.ORATABLE (d_date9,dt_datetime20,d_b8601da,dt_b8601dt,dt_datetime21) VALUES &lt;/P&gt;&lt;P&gt;(TO_DATE(:d_date9,'DDMONYYYY','NLS_DATE_LANGUAGE=American'),TO_DATE(:dt_datetime20,'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUAGE=American'),TO_DATE(:d_b8601da,'DDMONYYYY','NLS_DATE_LANGUAGE=American'),TO_DATE(:dt_b8601dt,'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUA&lt;/P&gt;&lt;P&gt;GE=American'),TO_DATE(:dt_datetime21,'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUAGE=American'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 1 observations read from the data set WORK.SASTABLE.&lt;/P&gt;&lt;P&gt;NOTE: The data set ORADB.ORATABLE has 1 observations and 5 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_13: Executed: on connection 3&lt;/P&gt;&lt;P&gt;INSERT statement&amp;nbsp; ORACLE_12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE:&amp;nbsp; *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-*&lt;/P&gt;&lt;P&gt;ORACLE:&amp;nbsp; *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-*&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE APPEND used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.91 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_14: Prepared: on connection 2&lt;/P&gt;&lt;P&gt;SELECT * FROM oradb.ORATABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_15: Prepared: on connection 3&lt;/P&gt;&lt;P&gt;SELECT * FROM oradb.ORATABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc append base=oradb.oratable data=work.sastable;&lt;/P&gt;&lt;P&gt;41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: Appending WORK.SASTABLE to ORADB.ORATABLE.&lt;/P&gt;&lt;P&gt;WARNING: Variable d_date9 has format 'DATETIME20.'n on the BASE data set and format 'DATE9.'n on the DATA data set. 'DATETIME20.'n used.&lt;/P&gt;&lt;P&gt;WARNING: Variable d_b8601da has format 'DATETIME20.'n on the BASE data set and format 'B8601DA.'n on the DATA data set. 'DATETIME20.'n used.&lt;/P&gt;&lt;P&gt;WARNING: Variable dt_b8601dt has format 'DATETIME20.'n on the BASE data set and format 'B8601DT.'n on the DATA data set. 'DATETIME20.'n used.&lt;/P&gt;&lt;P&gt;WARNING: Variable dt_datetime21 has format 'DATETIME20.'n on the BASE data set and format 'DATETIME21.'n on the DATA data set. 'DATETIME20.'n used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_16: Prepared: on connection 3&lt;/P&gt;&lt;P&gt;INSERT&amp;nbsp; INTO oradb.ORATABLE ("D_DATE9","DT_DATETIME20","D_B8601DA","DT_B8601DT","DT_DATETIME21") VALUES &lt;/P&gt;&lt;P&gt;(TO_DATE(:"D_DATE9",'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUAGE=American'),TO_DATE(:"DT_DATETIME20",'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUAGE=American'),TO_DATE(:"D_B8601DA",'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUAGE=American'),TO_DATE(:"DT_B8601DT",'DDMONYYY&lt;/P&gt;&lt;P&gt;Y:HH24:MI:SS','NLS_DATE_LANGUAGE=American'),TO_DATE(:"DT_DATETIME21",'DDMONYYYY:HH24:MI:SS','NLS_DATE_LANGUAGE=American'))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: There were 1 observations read from the data set WORK.SASTABLE.&lt;/P&gt;&lt;P&gt;NOTE: 1 observations added.&lt;/P&gt;&lt;P&gt;NOTE: The data set ORADB.ORATABLE has . observations and 5 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE_17: Executed: on connection 3&lt;/P&gt;&lt;P&gt;INSERT statement&amp;nbsp; ORACLE_16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE:&amp;nbsp; *-*-*-*-*-*-* COMMIT *-*-*-*-*-*-*&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE APPEND used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.88 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.02 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;And in Oracle&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/9167_Capture.PNG" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Feb 2015 01:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158020#M30876</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-02-14T01:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158021#M30877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick, ok that is showing very well a lot of issues around date/datetime and the SAS/ACCESS interface translation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably also knows that storing dates times and datetime is a crime as there is no standard. The result of that is every system is using his own standard, SAS standards, Oracle Standards, Teradata Standards, Excel standards, Sql Server standards and many more.&amp;nbsp; Even some mistakes with one supplier can be made, see: &lt;A _jive_internal="true" href="https://communities.sas.com/message/244963"&gt;https://communities.sas.com/message/244963&lt;/A&gt; (31dec9999 being different in SAS VA or SAS Base&amp;nbsp; must be an error)&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;That is having the consequence of needing a conversion when data is going from one to the other. The format usage as convention is an approach avoiding mentioning that conversion.&lt;/P&gt;&lt;P&gt;I agree that format convention is having a lot of pitfalls loopholes causing errors mistakes and confusing.&lt;/P&gt;&lt;P&gt;I agree as that could be an improvement for SAS to be done with high prio.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Going to your code.&lt;/P&gt;&lt;P&gt;1/ I am missing the ora table creation it must be the ora_11 one alle being created as date type in Oracle. Automaticly created.&lt;/P&gt;&lt;P&gt;&lt;A href="http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm" title="http://docs.oracle.com/cd/B19306_01/server.102/b14225/ch4datetime.htm"&gt;Datetime Datatypes and Time Zone Support&lt;/A&gt; (oracle) is telling Oracle does only have date types as known wit SAS datetime (yep confusing)&lt;/P&gt;&lt;P&gt;2/ That ora_12 statement is a surprise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - I would expect a bulkload approach instead it is executing a single insert (bad for performance)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - There are constants generated to Oracle. It did recognize SAS date() as Today and translated that as some constant.&amp;nbsp; &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)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It will put correct Oracle values into Oracle as your first observation.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; There must be something with: &lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#n1mar4dz971ln3n1lxmgx7hcgyc0.htm" title="http://support.sas.com/documentation/cdl/en/sqlproc/65065/HTML/default/viewer.htm#n1mar4dz971ln3n1lxmgx7hcgyc0.htm"&gt;SAS(R) 9.4 SQL Procedure User's Guide&lt;/A&gt; (SQLCONSTDATETIME) . As for me I do not see the trigger changing obs values to constants&lt;/P&gt;&lt;P&gt;3/ Adding those values out of SAS to the Oracle is going wrong (Oracle only having the equivalent of SAS datetime and not SAS date types)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Showing the SAS datetime-vales of the original SAS-Date ones are those zero-point SAS date values in your second row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Needing a overwrite for the conversion (you have those errors) you could use DBTYPE DBSASTYPE.&lt;/P&gt;&lt;P&gt;An other one is:&amp;nbsp; &lt;A href="http://support.sas.com/documentation/cdl/en/acreldb/67589/HTML/default/viewer.htm#p13xka550rm442n1gdvi1swxgr1h.htm" title="http://support.sas.com/documentation/cdl/en/acreldb/67589/HTML/default/viewer.htm#p13xka550rm442n1gdvi1swxgr1h.htm"&gt;SAS/ACCESS(R) 9.4 for Relational Databases: Reference, Sixth Edition&lt;/A&gt; (SASDATEFMT) The related examples are Oracle/Teradata &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;The goal is influencing the conversion! Formats labels etc. that are SAS specific are not stored into a RDBMS. That is getting lost as information. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Feb 2015 12:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158021#M30877</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2015-02-14T12:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Determine if a variable contains a SAS date value (part 2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158022#M30878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick: In addition to suggesting it to SAS, I think you should create a page on sasCommunity.org so that even more people can improve on the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached file is a slight modification of your original code, namely not creating and submitting an include block, rearranging ing the if/then/else conditions so that time is the last category checked, and adding some code so that user defined picture formats are included.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 15 Feb 2015 19:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determine-if-a-variable-contains-a-SAS-date-value-part-2/m-p/158022#M30878</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-15T19:23:13Z</dc:date>
    </item>
  </channel>
</rss>

