<?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 Choose a time range from a date time in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544784#M7932</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set and I need to filter based on a specific time from a datetime variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'11MAR2019&lt;STRONG&gt;:13:02:30 '&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to filter on all results post 5PM on the above variable, I'm new to SAS. I understand a timepart may be suitable here but I am unable to produce the results I require using this function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance for your assistance.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2019 09:53:12 GMT</pubDate>
    <dc:creator>KristianDagless</dc:creator>
    <dc:date>2019-03-21T09:53:12Z</dc:date>
    <item>
      <title>Choose a time range from a date time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544784#M7932</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set and I need to filter based on a specific time from a datetime variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'11MAR2019&lt;STRONG&gt;:13:02:30 '&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to filter on all results post 5PM on the above variable, I'm new to SAS. I understand a timepart may be suitable here but I am unable to produce the results I require using this function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance for your assistance.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 09:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544784#M7932</guid>
      <dc:creator>KristianDagless</dc:creator>
      <dc:date>2019-03-21T09:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: Choose a time range from a date time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544786#M7933</link>
      <description>&lt;P&gt;Please show your code and log, and some example data (in usable form - a data step with datalines), so we have material for diagnosis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your mention of the timepart() function is correct, though:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input dtval e8601dt19.;
format dtval e8601dt19.;
cards;
2019-03-20T08:00:00
2019-03-20T17:05:00
;
run;

data want;
set have;
where timepart(dtval) &amp;gt; '17:00:00't;
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;dtval

2019-03-20T17:05:00
&lt;/PRE&gt;
&lt;P&gt;Only the later of the two observations is selected.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 10:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544786#M7933</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-21T10:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Choose a time range from a date time</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544872#M7952</link>
      <description>&lt;P&gt;Or use one of the time extraction functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   where hour(dtval) ge 17;
run; &lt;/PRE&gt;
&lt;P&gt;for example. I wasn't sure if you wanted strictly greater than or greater than or equal so used the later.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 14:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Choose-a-time-range-from-a-date-time/m-p/544872#M7952</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-03-21T14:31:36Z</dc:date>
    </item>
  </channel>
</rss>

