<?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 Datetime in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690849#M24787</link>
    <description>&lt;P&gt;How to create hour,&amp;nbsp; minute, and second variables from datetimes formatted like 14may1998 05:43:32&lt;/P&gt;</description>
    <pubDate>Mon, 12 Oct 2020 00:23:47 GMT</pubDate>
    <dc:creator>msingam</dc:creator>
    <dc:date>2020-10-12T00:23:47Z</dc:date>
    <item>
      <title>Datetime</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690849#M24787</link>
      <description>&lt;P&gt;How to create hour,&amp;nbsp; minute, and second variables from datetimes formatted like 14may1998 05:43:32&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 00:23:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690849#M24787</guid>
      <dc:creator>msingam</dc:creator>
      <dc:date>2020-10-12T00:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690850#M24788</link>
      <description>&lt;P&gt;Something like this I think:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Hour = SUBSTR(result_dts, 11, 2);
Minute = SUBSTR(result_dts, 14, 2);
Second = SUBSTR(result_dts, 17, 2);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1602460774399.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50553i306BE762107C1A63/image-size/large?v=v2&amp;amp;px=999" role="button" title="jimbarbour_0-1602460774399.png" alt="jimbarbour_0-1602460774399.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S.&amp;nbsp; The above code will give you character values.&amp;nbsp; If you need to perform any type of numeric operations, you'll need to turn them into numeric variables by wrapping them in an INPUT() function.&amp;nbsp; Like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	Hour	=	INPUT(SUBSTR(result_dts, 11, 2), 2.);
	Minute	=	INPUT(SUBSTR(result_dts, 14, 2), 2.);
	Second	=	INPUT(SUBSTR(result_dts, 17, 2), 2.);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Oct 2020 00:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690850#M24788</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-12T00:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690853#M24790</link>
      <description>&lt;P&gt;&amp;nbsp;If result_dts is really a datetime value, then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;hour=hour(timepart(result_dts));
minute=minute(timepart(result_dts));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Seconds follows the same pattern, so I leave it up to you as a homework assignment.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 00:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690853#M24790</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-10-12T00:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Datetime</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690866#M24799</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering that myself, whether it was formatted text or a formatted SAS date. I guessed that it was text because of the lack of a colon between the date and the time.&amp;nbsp; I suppose that I guessed right, but your info is useful info either way since working with SAS dates is such a common need (as you well know I'm sure).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 00:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Datetime/m-p/690866#M24799</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-10-12T00:38:06Z</dc:date>
    </item>
  </channel>
</rss>

