<?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: time comparison in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266482#M52534</link>
    <description>&lt;P&gt;If you look at my code, the final part 4 one is:&lt;/P&gt;
&lt;P&gt;else timeslot="D";&lt;/P&gt;
&lt;P&gt;I.e. if it doesn't fit into the other three then it is D, you don't need the final conditional, it can only be 1, 2, 3 or else D.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2016 18:27:55 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-04-26T18:27:55Z</dc:date>
    <item>
      <title>time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266413#M52507</link>
      <description>&lt;P&gt;I have wagerdatetime variable, and I want to create a new variable timezone, based on the timepart(wagerdatetime):&lt;/P&gt;
&lt;P&gt;if 3-9 am, timeslot ="1", 9am-3pm, timeslot="2", 3-9 pm timeslot="3", 9pm-3am, timeslot="4".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first three are okay, but the 4th one, 9pm-3am the next day, how should I do it?&lt;/P&gt;
&lt;P&gt;maybe I should say 0:00:00-3:00:00&amp;nbsp; &amp;amp; 21:00"00-23:59:59?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if '3:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='9:00:00'T then timeslot="A";&lt;BR /&gt;if '9:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='15:00:00'T then timeslot="B";&lt;BR /&gt;if '15:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='21:00:00'T then timeslot="C";&lt;BR /&gt;if '21:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='3:00:00'T then timeslot="D";&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if '21:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='23:59:59'T then timeslot="D";
if '00:00:00'T =&amp;lt;timepart(wagerdatetime) &amp;lt;='3:00:00'T then timeslot="D";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I still have 3 with timeslot missing:&lt;/P&gt;
&lt;P&gt;08JUN14:00:00:00&lt;/P&gt;
&lt;P&gt;26JUN14:23:59:59&lt;/P&gt;
&lt;P&gt;12MAY14:00:00:00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;all others are fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 15:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266413#M52507</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-26T15:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266416#M52509</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if &amp;lt;condition&amp;gt; then;&lt;/P&gt;
&lt;P&gt;else if &amp;lt;conition&amp;gt; then;&lt;/P&gt;
&lt;P&gt;else;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So someting like:&lt;/P&gt;
&lt;PRE&gt;if '3:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='9:00:00'T then timeslot="A";
else if '9:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='15:00:00'T then timeslot="B";
else if '15:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='21:00:00'T then timeslot="C";
else timeslot="D";run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Apr 2016 15:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266416#M52509</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-26T15:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266419#M52510</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if '3:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='9:00:00'T then timeslot="A";
else if '9:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='15:00:00'T then timeslot="B";
else if '15:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='21:00:00'T then timeslot="C";
else if '21:00:00'T &amp;lt;timepart(wagerdatetime) &amp;lt;='23:59:59'T then timeslot="D";
else if '00:00:00'T =&amp;lt;timepart(wagerdatetime) &amp;lt;='3:00:00'T then timeslot="D";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;still got the three with timeslot missing&lt;/P&gt;
&lt;P&gt;08JUN14:00:00:00&lt;/P&gt;
&lt;P&gt;26JUN14:23:59:59&lt;/P&gt;
&lt;P&gt;12MAY14:00:00:00&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 15:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266419#M52510</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-26T15:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266433#M52517</link>
      <description />
      <pubDate>Tue, 26 Apr 2016 16:20:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266433#M52517</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-04-26T16:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266436#M52520</link>
      <description>&lt;P&gt;Or replace '23:59:59'T in the IF condition by '24:00:00'T in order to close the 1-second gap between 23:59:59 and 00:00:00.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 16:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266436#M52520</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-04-26T16:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266437#M52521</link>
      <description>Yes. this worked for the 3 missing&lt;BR /&gt;&lt;BR /&gt;Thank you.</description>
      <pubDate>Tue, 26 Apr 2016 16:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266437#M52521</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-26T16:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266482#M52534</link>
      <description>&lt;P&gt;If you look at my code, the final part 4 one is:&lt;/P&gt;
&lt;P&gt;else timeslot="D";&lt;/P&gt;
&lt;P&gt;I.e. if it doesn't fit into the other three then it is D, you don't need the final conditional, it can only be 1, 2, 3 or else D.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 18:27:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266482#M52534</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-26T18:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: time comparison in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266507#M52541</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9﻿&lt;/a&gt;&amp;nbsp; I did not see your code earlier. Sorry. Actually using else is a better/simpler way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I guess the "quick reply" inserted your post on the top but I was looking at bottom, so I missed your good suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 19:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/time-comparison-in-SAS/m-p/266507#M52541</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-26T19:27:44Z</dc:date>
    </item>
  </channel>
</rss>

