<?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: Datetime value to date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825940#M326233</link>
    <description>&lt;P&gt;I have a lot of files that apparently originate in not-well set up databases where I get date values that come as datetime values like that, some times as many as 30 date fields per record. Every single "time" component is 00:00:00. So using just the date format to read the date part makes lots of sense and I do it in the data step to read the file instead of waiting to fix it later.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 14:32:17 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-07-28T14:32:17Z</dc:date>
    <item>
      <title>Datetime value to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825843#M326180</link>
      <description>&lt;P&gt;Can soomeone help me to convert character datetime value to numeric date? Desired output is '01DEC2021'd which is in date9. format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
a='2021-12-01 21:56:59.0000000';
b=input(a,27.);
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 06:21:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825843#M326180</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2022-07-28T06:21:01Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime value to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825852#M326186</link>
      <description>&lt;PRE&gt;data test;
a='2021-12-01 21:56:59.0000000';
&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;d=input(scan(a,1,' '),yymmdd10.);
format d date9.;&lt;/STRONG&gt;&lt;/FONT&gt;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 07:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825852#M326186</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-07-28T07:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime value to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825864#M326194</link>
      <description>&lt;P&gt;You can apply the YYMMDD10. informat directly, as it will only read the first 10 characters:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
a = '2021-12-01 21:56:59.0000000';
b = input(a,yymmdd10.);
format b yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To read the whole string as a datetime, use the E8601DT. informat:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
a = '2021-12-01 21:56:59.0000000';
b = input(a,e8601dt26.);
c = datepart(b);
format
  b e8601dt26.6
  c yymmdd10.
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 08:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825864#M326194</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-28T08:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime value to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825940#M326233</link>
      <description>&lt;P&gt;I have a lot of files that apparently originate in not-well set up databases where I get date values that come as datetime values like that, some times as many as 30 date fields per record. Every single "time" component is 00:00:00. So using just the date format to read the date part makes lots of sense and I do it in the data step to read the file instead of waiting to fix it later.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 14:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Datetime-value-to-date/m-p/825940#M326233</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-07-28T14:32:17Z</dc:date>
    </item>
  </channel>
</rss>

