<?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: MMDDYY10 FORMAT TO DATETIME20 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240023#M268340</link>
    <description>&lt;P&gt;You'll need a bit&amp;nbsp; more the new value should be built with the DHMS function to get the correct offset. If your current variable operation_dt is character then :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATETIMEVariable = DHMS(input(operation_dt,mmddyy10.),0,0,0);&lt;/P&gt;
&lt;P&gt;where the 0 are the hour, minute and second you want to assign, you could use any valid hour, minute and second value&lt;/P&gt;
&lt;P&gt;If the Operation_DT variable is a SAS date value then you could use&lt;/P&gt;
&lt;P&gt;Operation_DT = DHMS(Operation_DT&amp;nbsp;,0,0,0);&lt;/P&gt;
&lt;P&gt;then assign a datetime format:&lt;/P&gt;
&lt;P&gt;Format Operation_DT&amp;nbsp;datetime20.;&lt;/P&gt;
&lt;P&gt;I would strongly suggest not creating character variables to hold datetime values as if you ever need pieces, such as month, day, year, or want to compare with other values you end up with lots of headaches.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Dec 2015 15:51:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-12-18T15:51:19Z</dc:date>
    <item>
      <title>MMDDYY10 FORMAT TO DATETIME20</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240021#M268339</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to convert a date format from MMDDYY10. to DATETIME20.&amp;nbsp; I've tried just about every suggestion I could Google and here and nothing is working.&amp;nbsp; Here's my latest stab...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ETRM_CREP_VA1_SWING;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SET&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; ETRM_CREP_VA1_SWING;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; OPERATION_DT = INPUT(OPERATION_DT, &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;MMDDYY10.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;)*&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;86400&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 15:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240021#M268339</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2015-12-18T15:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: MMDDYY10 FORMAT TO DATETIME20</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240023#M268340</link>
      <description>&lt;P&gt;You'll need a bit&amp;nbsp; more the new value should be built with the DHMS function to get the correct offset. If your current variable operation_dt is character then :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATETIMEVariable = DHMS(input(operation_dt,mmddyy10.),0,0,0);&lt;/P&gt;
&lt;P&gt;where the 0 are the hour, minute and second you want to assign, you could use any valid hour, minute and second value&lt;/P&gt;
&lt;P&gt;If the Operation_DT variable is a SAS date value then you could use&lt;/P&gt;
&lt;P&gt;Operation_DT = DHMS(Operation_DT&amp;nbsp;,0,0,0);&lt;/P&gt;
&lt;P&gt;then assign a datetime format:&lt;/P&gt;
&lt;P&gt;Format Operation_DT&amp;nbsp;datetime20.;&lt;/P&gt;
&lt;P&gt;I would strongly suggest not creating character variables to hold datetime values as if you ever need pieces, such as month, day, year, or want to compare with other values you end up with lots of headaches.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Dec 2015 15:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240023#M268340</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-18T15:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: MMDDYY10 FORMAT TO DATETIME20</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240027#M268341</link>
      <description>That worked, thanks so much!</description>
      <pubDate>Fri, 18 Dec 2015 15:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MMDDYY10-FORMAT-TO-DATETIME20/m-p/240027#M268341</guid>
      <dc:creator>BU2B</dc:creator>
      <dc:date>2015-12-18T15:58:03Z</dc:date>
    </item>
  </channel>
</rss>

