<?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 default timestamp ('0001-01-01 00:00:00.000000) in sas in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830596#M35584</link>
    <description>its a default date in our source system  , we are just want to maintain same source data in sas datasets</description>
    <pubDate>Fri, 26 Aug 2022 14:04:25 GMT</pubDate>
    <dc:creator>learn_SAS_23</dc:creator>
    <dc:date>2022-08-26T14:04:25Z</dc:date>
    <item>
      <title>how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830574#M35582</link>
      <description>&lt;P&gt;Hello Team ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DB2 table had the value&amp;nbsp;'0001-01-01 00:00:00.000000' in Trans_time column&amp;nbsp; as a default time .&lt;/P&gt;
&lt;P&gt;But while reading and loading to a sas data set , this value is converted as null&amp;nbsp; . am using datetime26.6 while defining the column in DIS&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="learn_SAS_23_0-1661519501332.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74750i49D61DD54334442D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="learn_SAS_23_0-1661519501332.png" alt="learn_SAS_23_0-1661519501332.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it works for all other rows&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;ex : 2022-06-30 04:37:21.973671 , but only the row which has&amp;nbsp;'0001-01-01 00:00:00.000000' is converted in to NULL&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Can some one guide , how to convert ''0001-01-01 00:00:00.000000'' value from db2 to sas&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 13:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830574#M35582</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2022-08-26T13:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830584#M35583</link>
      <description>&lt;P&gt;The question is what does that date represent, I'm assuming it's not midnight on the 1st January 0001, and SAS is probably assuming it's an invalid date thus setting it to missing.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 13:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830584#M35583</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2022-08-26T13:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830596#M35584</link>
      <description>its a default date in our source system  , we are just want to maintain same source data in sas datasets</description>
      <pubDate>Fri, 26 Aug 2022 14:04:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830596#M35584</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2022-08-26T14:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830616#M35585</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/225493"&gt;@learn_SAS_23&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could define a custom informat and format. As there is no numeric equivalent in SAS for the datetime "0001-01...", I suggest a special missing value, e.g., &lt;FONT face="courier new,courier"&gt;.D&lt;/FONT&gt;.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
invalue DB2dt
'0001-01-01 00:00:00.000000' = .d
other = [e8601dt26.];

value DB2dt
.d = '0001-01-01T00:00:00.000000'
other = [e8601dt26.6];
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm not familiar with DB2 or DIS, so the example below uses SAS character data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create example data for demonstration */

data have;
input Trans_time $26.;
cards;
2022-06-30 04:37:21.973671
0001-01-01 00:00:00.000000
;

/* Convert DB2 to SAS datetime values */

data want;
set have;
Trans_dt=input(Trans_time, DB2dt.);
format Trans_dt DB2dt.;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt;Obs            Trans_time                     Trans_dt

 1     2022-06-30 04:37:21.973671    2022-06-30T04:37:21.973671
 2     0001-01-01 00:00:00.000000    0001-01-01T00:00:00.000000&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2022 15:10:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830616#M35585</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-08-26T15:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830628#M35586</link>
      <description>&lt;P&gt;Years prior to about 1582 are not valid years because of calendar inconsistencies prior.&lt;/P&gt;
&lt;P&gt;I doubt that your data is actually from Year 1 CE(and you really have to be specific about where you are to get January 1 as the calendar has been played with a lot since anything resembling Year 1 CE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS will treat any attempt to use a year prior to 1582 as invalid hence the missing value. I bet that you log shows an "invalid data" message somewhere.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 15:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/830628#M35586</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-08-26T15:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/831236#M35619</link>
      <description>thanks for everyone inputs , from this Atleast DIS doesn't support the dates prior to about 1582  , all are treated as NULL</description>
      <pubDate>Wed, 31 Aug 2022 11:28:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/831236#M35619</guid>
      <dc:creator>learn_SAS_23</dc:creator>
      <dc:date>2022-08-31T11:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert default timestamp ('0001-01-01 00:00:00.000000) in sas</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/831246#M35620</link>
      <description>&lt;P&gt;You don't need that in SAS.&amp;nbsp; Unlike DB2 in SAS boolean logic is actually boolean, there are only two outcomes, TRUE or FALSE.&lt;/P&gt;
&lt;P&gt;In DB2 comparisons using a null value (what SAS would call a missing value)&amp;nbsp; result in a null result instead of either TRUE or FALSE.&amp;nbsp; Since SAS treats missing as less than any actual number the result will be the same as you get in DB2 by using that ridiculous value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not totally sure how "default" values work in DB2 , but that might also make the missing values in the SAS datasets work when trying to insert observations back into the DB2 table.&amp;nbsp; The missing values might be converted to DB2 null values and thus trigger DB2 to store instead the default value.&amp;nbsp; Try it and see.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 13:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-convert-default-timestamp-0001-01-01-00-00-00-000000-in/m-p/831246#M35620</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-31T13:27:07Z</dc:date>
    </item>
  </channel>
</rss>

