<?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 get YYYY-MM-DDThh:mm:ss from date (yymmdd10.) and time ( tod8.) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692910#M211181</link>
    <description>&lt;P&gt;In SAS,&amp;nbsp;&lt;STRONG&gt;YOU DO NOT STORE DATES OR TIMES AS CHARACTER&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Any format for display can be used whenever needed (eg for reports or export), but storing such values as character deprives you of the use of date&amp;amp;time functions and formats and necessitates re-conversion whenever a calculation needs to be done.&lt;/P&gt;
&lt;P&gt;On top of that all, you need much more space to store a datetime as character (19 characters here) vs. numeric (only 8 bytes). Same for dates (minimum 8 characters without delimiters), which need only 4 numeric bytes.&lt;/P&gt;
&lt;P&gt;Storing dates and times as character is plain dumb, to be VERY polite.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Oct 2020 15:00:56 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-10-20T15:00:56Z</dc:date>
    <item>
      <title>How to get YYYY-MM-DDThh:mm:ss from date (yymmdd10.) and time ( tod8.)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692897#M211178</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;How to get YYYY-MM-DDThh:mm:ss from date (yymmdd10.) and time ( tod8.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My approch is mentioned below which is not proper for 1st record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data xyz;&lt;BR /&gt;date="12-Aug-2020";&lt;BR /&gt;output;&lt;BR /&gt;Time= "11:45 PM";&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data abc;&lt;BR /&gt;set xyz;&lt;BR /&gt;date1=put(input(date,anydtdte20.),yymmdd10.);&lt;BR /&gt;time1 = put(input(time,time8.),tod8.);&lt;BR /&gt;date_time = catx ("T",date1,time1);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692897#M211178</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2020-10-20T14:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get YYYY-MM-DDThh:mm:ss from date (yymmdd10.) and time ( tod8.)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692901#M211179</link>
      <description>&lt;P&gt;First of all, look at your dataset xyz; it has one observation with a missing time, and another with date and time.&lt;/P&gt;
&lt;P&gt;Remove the OUTPUT statements if you &amp;nbsp;want to have exactly one observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The proper way to create a timestamp (datetime) out of a separate time and date is the DHMS function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data abc;
set xyz;
date1=input(date,anydtdte20.);
time1 = input(time,time8.);
date_time = dhms(date1,0,0,time1);
format date_time e8601dt19.;
run;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692901#M211179</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-20T14:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get YYYY-MM-DDThh:mm:ss from date (yymmdd10.) and time ( tod8.)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692906#M211180</link>
      <description>date1 and time1 are char not num and required date_time would be in same format (char with 20 length).&lt;BR /&gt;&lt;BR /&gt;time1 has blank record in given data , i have kept it intentionally.&lt;BR /&gt;&lt;BR /&gt;( i think dhms function works for num only, plz correct me if i am wrong)</description>
      <pubDate>Tue, 20 Oct 2020 14:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692906#M211180</guid>
      <dc:creator>pdhokriya</dc:creator>
      <dc:date>2020-10-20T14:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to get YYYY-MM-DDThh:mm:ss from date (yymmdd10.) and time ( tod8.)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692910#M211181</link>
      <description>&lt;P&gt;In SAS,&amp;nbsp;&lt;STRONG&gt;YOU DO NOT STORE DATES OR TIMES AS CHARACTER&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;Any format for display can be used whenever needed (eg for reports or export), but storing such values as character deprives you of the use of date&amp;amp;time functions and formats and necessitates re-conversion whenever a calculation needs to be done.&lt;/P&gt;
&lt;P&gt;On top of that all, you need much more space to store a datetime as character (19 characters here) vs. numeric (only 8 bytes). Same for dates (minimum 8 characters without delimiters), which need only 4 numeric bytes.&lt;/P&gt;
&lt;P&gt;Storing dates and times as character is plain dumb, to be VERY polite.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 15:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-YYYY-MM-DDThh-mm-ss-from-date-yymmdd10-and-time-tod8/m-p/692910#M211181</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-10-20T15:00:56Z</dc:date>
    </item>
  </channel>
</rss>

