<?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 extract hour minutes and seconds from sas datetime19. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852273#M336912</link>
    <description>&lt;P&gt;Why do you need 00 ?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jan 2023 13:31:11 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2023-01-05T13:31:11Z</dc:date>
    <item>
      <title>how to extract hour minutes and seconds from sas datetime19.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852266#M336908</link>
      <description>&lt;P&gt;I have sas date time19.&amp;nbsp; and want to extract hour minutes and seconds, I can use hour() function but if it is 00 then it wont work&lt;/P&gt;
&lt;P&gt;date&lt;/P&gt;
&lt;P&gt;15NOV2022:00:00:00&lt;/P&gt;
&lt;P&gt;hour&amp;nbsp; minute&amp;nbsp; second&lt;/P&gt;
&lt;P&gt;00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help me in this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 13:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852266#M336908</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2023-01-05T13:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract hour minutes and seconds from sas datetime19.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852268#M336909</link>
      <description>&lt;P&gt;Yes. The Functions Hour, Minute and Second all support datetime values.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 13:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852268#M336909</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-01-05T13:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract hour minutes and seconds from sas datetime19.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852270#M336910</link>
      <description>&lt;P&gt;Yes, but if hour is missing it only give "0" but i need "00"&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 13:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852270#M336910</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2023-01-05T13:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract hour minutes and seconds from sas datetime19.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852272#M336911</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, but if hour is missing it only give "0" but i need "00"&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In SAS, a numeric variable can have a value of 0 but it cannot have a value of 00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really need a value of 00, assign a custom format to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This of course brings up the question, why do you need 00? Are you going to use it as a character string? Please explain this, as there are probably better ways to handle this.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 13:30:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852272#M336911</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-05T13:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract hour minutes and seconds from sas datetime19.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852273#M336912</link>
      <description>&lt;P&gt;Why do you need 00 ?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 13:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852273#M336912</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2023-01-05T13:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract hour minutes and seconds from sas datetime19.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852290#M336920</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, but if hour is missing it only give "0" but i need "00"&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Zero is not a missing value.&amp;nbsp; If the HOUR was missing then the whole datetime value would have had to have been missing.&lt;/P&gt;
&lt;P&gt;If you have the value zero there is no difference between typing it as 0 or 00 or 0000 they all mean zero.&lt;/P&gt;
&lt;P&gt;If you want to have a number printed using leading zeros then use the Z format.&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  time=timepart(dtvar);
  hour=hour(dtvar);
  minute=minute(dtvar);
  second=second(dtvar);
  format time tod8. hour minute second z2. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Jan 2023 15:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-extract-hour-minutes-and-seconds-from-sas-datetime19/m-p/852290#M336920</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-05T15:09:02Z</dc:date>
    </item>
  </channel>
</rss>

