<?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: proc sql datetime column returns 0 in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789734#M40138</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="top 11.png" style="width: 315px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67351i16434ACF13A93988/image-size/large?v=v2&amp;amp;px=999" role="button" title="top 11.png" alt="top 11.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jan 2022 14:37:42 GMT</pubDate>
    <dc:creator>DorukK</dc:creator>
    <dc:date>2022-01-12T14:37:42Z</dc:date>
    <item>
      <title>proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789675#M40130</link>
      <description>&lt;P&gt;AuditInformation_CreatedDate&lt;BR /&gt;2021-11-15 08:35:04.4351830&lt;BR /&gt;2021-11-15 08:35:04.4351830&lt;BR /&gt;2021-12-17 06:21:12.1300279&lt;BR /&gt;2021-09-26 16:54:14.0000000&lt;BR /&gt;2021-09-14 18:39:24.0000000&lt;BR /&gt;2021-09-06 12:54:52.0000000&lt;BR /&gt;2021-09-04 19:04:44.0000000&lt;BR /&gt;2021-09-04 18:33:52.0000000&lt;BR /&gt;2021-09-15 20:42:22.0000000&lt;BR /&gt;2021-10-02 17:30:20.0000000&lt;BR /&gt;2021-09-21 18:23:30.0000000&lt;/P&gt;&lt;P&gt;This is my datetime column in mssql. I would like to access AuditInformation_CreatedDate column in my customer table from EG and when I select the output looks like this:&lt;/P&gt;&lt;P&gt;proc sql outobs=22;&lt;/P&gt;&lt;P&gt;select put(AuditInformation_CreatedDate, 27.) from &amp;amp;sas_db_libref_idmap..Customer;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;SAS Output&lt;BR /&gt;&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;BR /&gt;0&lt;/P&gt;&lt;P&gt;proc sql outobs=22;&lt;/P&gt;&lt;P&gt;select AuditInformation_CreatedDate from &amp;amp;sas_db_libref_idmap..Customer;&lt;BR /&gt;quit;&lt;BR /&gt;SAS Output&lt;BR /&gt;AuditInformation_CreatedDate&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;BR /&gt;01JAN1960:00:00:00.0000000&lt;/P&gt;&lt;P&gt;How can I solve this issue? Why does EG get my date column as 0?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 11:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789675#M40130</guid>
      <dc:creator>DorukK</dc:creator>
      <dc:date>2022-01-12T11:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789676#M40131</link>
      <description>&lt;P&gt;If these values in the database are truly &lt;EM&gt;numeric&lt;/EM&gt; date/time values, you shouldn't need to do any PUT or INPUT, you just need the proper format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select AuditInformation_CreatedDate format=datetime24. from &amp;amp;sas_db_libref_idmap..Customer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But if they are &lt;EM&gt;character&lt;/EM&gt; values, that won't work. So, are they numeric or are they character? What does PROC CONTENTS say about this variable in &amp;amp;sas_db_libref_idmap..customer?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 11:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789676#M40131</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-12T11:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789679#M40132</link>
      <description>&lt;DIV&gt;Here is the script and output for proc contents:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc sql outobs=22;&lt;BR /&gt;create table _Temp_ as&lt;BR /&gt;select AuditInformation_CreatedDate from &amp;amp;sas_db_libref_idmap..Customer;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;proc contents data=work._temp_;&lt;BR /&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output.png" style="width: 572px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67342iE29134DDAA26ADE3/image-size/large?v=v2&amp;amp;px=999" role="button" title="output.png" alt="output.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;This is the data type in the database:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="create date.png" style="width: 391px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67343i5507E99B4BFF8AAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="create date.png" alt="create date.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 11:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789679#M40132</guid>
      <dc:creator>DorukK</dc:creator>
      <dc:date>2022-01-12T11:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789701#M40133</link>
      <description>&lt;P&gt;So does the solution I gave help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You shouldn't even need to apply a format here, as it is already formatted.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789701#M40133</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-12T13:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789702#M40134</link>
      <description>&lt;P&gt;In the database the values are not 01JAN1960. When we set the format as datetime24. it returns&amp;nbsp;01JAN1960&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789702#M40134</guid>
      <dc:creator>DorukK</dc:creator>
      <dc:date>2022-01-12T13:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789704#M40135</link>
      <description>&lt;P&gt;You said the values in the database are, for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2021-11-15 08:35:04.4351830&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is that correct? So if you do a PROC PRINT directly from the database, what do you see?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=&amp;amp;sas_db_libref_idmap..Customer(obs=10);
    var AuditInformation_CreatedDate;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:31:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789704#M40135</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-12T13:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789711#M40136</link>
      <description>&lt;DIV&gt;Yes, the values are like&amp;nbsp;&lt;SPAN&gt;2021-11-15 08:35:04.4351830 value in the database.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Here is the output for the script:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc print data=&amp;amp;sas_db_libref_idmap..Customer(obs=10);&lt;BR /&gt;var &amp;nbsp;AuditInformation_CreatedDate;&lt;BR /&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc print.png" style="width: 215px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67347i1AF60B6341EFF680/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc print.png" alt="proc print.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789711#M40136</guid>
      <dc:creator>DorukK</dc:creator>
      <dc:date>2022-01-12T13:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789712#M40137</link>
      <description>&lt;P&gt;Ok, make a screen capture the actual database and show us the first 10 rows or so.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 13:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789712#M40137</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-12T13:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789734#M40138</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="top 11.png" style="width: 315px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67351i16434ACF13A93988/image-size/large?v=v2&amp;amp;px=999" role="button" title="top 11.png" alt="top 11.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 14:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789734#M40138</guid>
      <dc:creator>DorukK</dc:creator>
      <dc:date>2022-01-12T14:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789737#M40139</link>
      <description>&lt;P&gt;Okay, this is not making sense to me. Maybe others have some idea.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 14:50:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789737#M40139</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-12T14:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789738#M40140</link>
      <description>&lt;P&gt;How did you connect to the database?&lt;/P&gt;
&lt;P&gt;What ENGINE are you using? ODBC? Something else?&lt;/P&gt;
&lt;P&gt;What driver version are you using for the connection?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 14:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789738#M40140</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-12T14:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql datetime column returns 0</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789758#M40143</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/384930"&gt;@DorukK&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In the database the values are not 01JAN1960. When we set the format as datetime24. it returns&amp;nbsp;01JAN1960&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This likely indicates that somewhere in the process you have a value extremely close to if not exactly zero.&lt;/P&gt;
&lt;P&gt;I might suggest running this and showing the result:&lt;/P&gt;
&lt;PRE&gt;proc sql outobs=22;

select put(AuditInformation_CreatedDate, best16.) from &amp;amp;sas_db_libref_idmap..Customer;
quit;&lt;/PRE&gt;
&lt;P&gt;The 27. format would round anything between -0.5 and 0.5 to zero, so your format choice may be hiding something.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still see zero then that is the value sent across from your connection to the external data base. At that point I would ask how you know the values you are showing with the 01Jan1960 date portion are from the same records as the dates you show in the first post? Suggest that you consider looking at some identification variables and make sure you are comparing the same records.&lt;/P&gt;
&lt;P&gt;I am &lt;STRONG&gt;guessing&lt;/STRONG&gt; that your picture of the variable properties in the external database that has a "not null" as part of the description means that there must be something in the field. So you may just possibly find out that 0 (zero) is a default date when a more interesting value is not yet assigned such as an Audit has not been created yet. You might check to see if the data set is sorted by that value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 17:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sql-datetime-column-returns-0/m-p/789758#M40143</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-12T17:08:55Z</dc:date>
    </item>
  </channel>
</rss>

