<?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: SAS Date Format Required in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858903#M42255</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430243"&gt;@MayurJadhav&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm assuming this X variable actually a datetime variable but appears as sas date in numeric.&lt;/P&gt;
&lt;P&gt;if so then here is how you can get date and time in desired formatd.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format dt datetime25.;
  dt=datetime();
  dttm = put(datepart(dt), yymmddd10.)||put(datepart(dt), tod11.);
  put dttm= ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;PRE&gt;dttm=2023-02-15   06:24:16&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would recommend doing something else, because the above solution gives you a character string for DTTM. Better would be to use the DHMS function to obtain a numeric date/time value, as already explained above by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; . Numeric date/time values can be used in arithmetic or in boolean logic easily, character strings not so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    value=44673.77414351851;
    sas_date_value='30DEC1899'd+floor(value); /* Integer part of 44673.77414351851 */
    sas_time_value=86400*(value-floor(value)); /* Decimal part of 44673.77414351851 */
    sas_date_time_value=dhms(sas_date_value,hour(sas_time_value),minute(sas_time_value),second(sas_time_value));
    format sas_date_value date9. sas_time_value time. sas_date_time_value datetime19.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Feb 2023 11:51:11 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-02-15T11:51:11Z</dc:date>
    <item>
      <title>SAS Date Format Required</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858884#M42249</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a Issue in Date format as I was unable to make it usable format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried Proc Format (User Defined) and other SAS Date Functions as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want it in 0000-00-00 00:00:00 this format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;X Variable&lt;/P&gt;&lt;P&gt;44673.77414351851&lt;/P&gt;&lt;P&gt;44747.78288194445&lt;/P&gt;&lt;P&gt;0000-00-00 00:00:00&lt;/P&gt;&lt;P&gt;0000-00-00 00:00:00&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 09:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858884#M42249</guid>
      <dc:creator>saikiran_nemani</dc:creator>
      <dc:date>2023-02-15T09:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date Format Required</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858885#M42250</link>
      <description>&lt;P&gt;What does&amp;nbsp;&lt;SPAN&gt;44673.77414351851 represent?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 09:33:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858885#M42250</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-02-15T09:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date Format Required</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858886#M42251</link>
      <description>&lt;P&gt;In my excel sheet, it was showing as 22-04-2022 18:34:36.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I used Proc Import and it showing as a number.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 09:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858886#M42251</guid>
      <dc:creator>saikiran_nemani</dc:creator>
      <dc:date>2023-02-15T09:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date Format Required</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858893#M42252</link>
      <description>&lt;P&gt;So you run into the usual troubles with Excel crap.&lt;/P&gt;
&lt;P&gt;Add '30dec1899'd to the &lt;U&gt;integer&lt;/U&gt; part of the number to get the date in SAS, and multiply the &lt;U&gt;fractional&lt;/U&gt; part by 86400 to get the time. Use the DHMS function to combine both parts into a datetime, and apply an appropriate format.&lt;/P&gt;
&lt;P&gt;You may need to create a custom picture format for this.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 10:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858893#M42252</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-02-15T10:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date Format Required</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858897#M42254</link>
      <description>&lt;P&gt;I'm assuming this X variable actually a datetime variable but appears as sas date in numeric.&lt;/P&gt;
&lt;P&gt;if so then here is how you can get date and time in desired formatd.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format dt datetime25.;
  dt=datetime();
  dttm = put(datepart(dt), yymmddd10.)||put(datepart(dt), tod11.);
  put dttm= ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;PRE&gt;dttm=2023-02-15   06:24:16&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 10:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858897#M42254</guid>
      <dc:creator>MayurJadhav</dc:creator>
      <dc:date>2023-02-15T10:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date Format Required</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858903#M42255</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430243"&gt;@MayurJadhav&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm assuming this X variable actually a datetime variable but appears as sas date in numeric.&lt;/P&gt;
&lt;P&gt;if so then here is how you can get date and time in desired formatd.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  format dt datetime25.;
  dt=datetime();
  dttm = put(datepart(dt), yymmddd10.)||put(datepart(dt), tod11.);
  put dttm= ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;output:&lt;/P&gt;
&lt;PRE&gt;dttm=2023-02-15   06:24:16&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would recommend doing something else, because the above solution gives you a character string for DTTM. Better would be to use the DHMS function to obtain a numeric date/time value, as already explained above by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; . Numeric date/time values can be used in arithmetic or in boolean logic easily, character strings not so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    value=44673.77414351851;
    sas_date_value='30DEC1899'd+floor(value); /* Integer part of 44673.77414351851 */
    sas_time_value=86400*(value-floor(value)); /* Decimal part of 44673.77414351851 */
    sas_date_time_value=dhms(sas_date_value,hour(sas_time_value),minute(sas_time_value),second(sas_time_value));
    format sas_date_value date9. sas_time_value time. sas_date_time_value datetime19.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Feb 2023 11:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/SAS-Date-Format-Required/m-p/858903#M42255</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-15T11:51:11Z</dc:date>
    </item>
  </channel>
</rss>

