<?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: Create timestamp yyyy-MM-dd HH:mm:ss in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749452#M235502</link>
    <description>&lt;P&gt;Indeed you can do this using the DHMS function. Assuming your variable DATE is a SAS date and HOUR is numeric you would get something like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; 
	date = '22jun2021'd; 
	hour = 13; 

	timestamp = dhms(date, hour, 0, 0);

	format date date9. timestamp datetime22.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In case your DATE variable is character, you would need to do some pre-processing to get to the timestamp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jun 2021 09:46:18 GMT</pubDate>
    <dc:creator>NicoM</dc:creator>
    <dc:date>2021-06-22T09:46:18Z</dc:date>
    <item>
      <title>Create timestamp yyyy-MM-dd HH:mm:ss</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749443#M235498</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have variable with date and hour, what I'd like to do is to create a timestamp. For example:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;DATE&lt;/TD&gt;
&lt;TD width="50%"&gt;HOUR&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;2021-06-22&lt;/TD&gt;
&lt;TD width="50%"&gt;13&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;I wish I could get 2021-06-22 13:00:00&lt;/P&gt;
&lt;P&gt;How can I solve that?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 09:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749443#M235498</guid>
      <dc:creator>PatrykSAS</dc:creator>
      <dc:date>2021-06-22T09:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create timestamp yyyy-MM-dd HH:mm:ss</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749445#M235500</link>
      <description>&lt;P&gt;Use the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lefunctionsref/p1b9d1kbo0czoxn1ouj1kcxwqzn1.htm" target="_blank" rel="noopener"&gt;DHMS&lt;/A&gt;&amp;nbsp;function.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 09:39:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749445#M235500</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-06-22T09:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create timestamp yyyy-MM-dd HH:mm:ss</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749452#M235502</link>
      <description>&lt;P&gt;Indeed you can do this using the DHMS function. Assuming your variable DATE is a SAS date and HOUR is numeric you would get something like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want; 
	date = '22jun2021'd; 
	hour = 13; 

	timestamp = dhms(date, hour, 0, 0);

	format date date9. timestamp datetime22.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In case your DATE variable is character, you would need to do some pre-processing to get to the timestamp.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 09:46:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-timestamp-yyyy-MM-dd-HH-mm-ss/m-p/749452#M235502</guid>
      <dc:creator>NicoM</dc:creator>
      <dc:date>2021-06-22T09:46:18Z</dc:date>
    </item>
  </channel>
</rss>

