<?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 If And Not Working in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35069#M8596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect I am in agreement with you, but start with different objectives: &lt;/P&gt;&lt;P&gt;"Midnight" is specific and the only trouble is deciding to which "date" it belongs. Clearly for SAS, in a datetime value, midnight belongs to the following day (0 seconds into the day). The datetime value 86399 is still in 01Jan1960 and one second later&amp;nbsp; datepart(86400) returns the next day. &lt;/P&gt;&lt;P&gt;This is consistent with other SAS interval values which start having the sub-interval= 0 which is another way of saying datetime is "at the start of the interval".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can live with this interpretation that SAS provides - midnight is at the beginning of a day and has time value 0 or 00:00:00. It is the addition of AM or PM to the 12th hour that I find really unhelpful --&amp;gt; it requires more text than the military time and doesn't clarify (for me). For clarity, I would never recommend using AM and PM with time constants. I haven't found anyone unclear about 24hour clock time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I should enter the modern world of 12PM as it seems I'm very much in a 'midday' minority. &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;and also pay more attention to the OP questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jan 2012 12:33:44 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2012-01-25T12:33:44Z</dc:date>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35060#M8587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I have a data step where I used a IF and Statement. When it runs it doesn't use the starttime and end time provided &lt;/P&gt;&lt;P&gt;STARTtime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EndTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Day_Diff&lt;/P&gt;&lt;P&gt;05:32:00AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10:45:00 AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;01/26/12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/26/12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;DATA&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp; StartTime &amp;gt;= &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;'20:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;/*Ticket open after 8PM anyday*/&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; AND ENDTime &amp;lt;= &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;'12:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;/*Ticket open after 8PM anyday*/&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; AND DAY_DIFF &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; PAY=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;"YES"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;I don't know what I'm doing wrong. I've it formatted&amp;nbsp; TimeAMPM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;Thanks for any as.. FYI I'm looking for in Day_Diff 0 and 1&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 01:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35060#M8587</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2012-01-21T01:15:28Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35061#M8588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you're using AM and PM what is the meaning of &lt;STRONG style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;'20:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;Shouldn't this be &lt;STRONG style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;'08:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; ?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 01:51:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35061#M8588</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-01-21T01:51:48Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35062#M8589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Patrick,&lt;/P&gt;&lt;P&gt;I've been using diffrent formats ..I must copy my last attempt ( Reason for the other format). I did try your recomendation ...same output.. It Seems like Starttime and Endtime isn't read correctly&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: navy; font-size: 10pt;"&gt;DATA&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp; StartTime &amp;gt;= &lt;/SPAN&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;'08:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;/*Ticket open after 8PM anyday*/&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; AND ENDTime &amp;lt;= &lt;/SPAN&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;'12:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 10pt;"&gt;/*Ticket open after 8PM anyday*/&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; AND DAY_DIFF &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="min-height: 8pt; height: 8pt;"&gt; &lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; PAY=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;"YES"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;STRONG style="font-family: 'Courier New'; background: white; color: navy; font-size: 10pt;"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 04:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35062#M8589</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2012-01-21T04:14:10Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35063#M8590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I believe the other issue you're having is that &lt;STRONG style="font-family: 'Courier New'; background: white; color: teal; font-size: 10pt;"&gt;'12:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; is interpreted as noon and not midnight.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; I suggest to use a 24 hours day and function HMS() to avoid any further problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;DATA _null_;&lt;BR /&gt;&amp;nbsp; StartTime='08:00:00PM'T;&lt;BR /&gt;&amp;nbsp; put StartTime=;&lt;BR /&gt;&amp;nbsp; ENDTime = '12:00:00PM'T;&lt;BR /&gt;&amp;nbsp; put ENDTime=;&lt;BR /&gt;&amp;nbsp; ENDTime = '12:00:00AM'T;&lt;BR /&gt;&amp;nbsp; put ENDTime=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* use hms() */&lt;BR /&gt;&amp;nbsp; StartTime=hms(20,0,0);&lt;BR /&gt;&amp;nbsp; put StartTime=;&lt;BR /&gt;&amp;nbsp; Endtime=hms(24,0,0);&lt;BR /&gt;&amp;nbsp; put EndTime=;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 05:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35063#M8590</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-01-21T05:28:43Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35064#M8591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are starttime and endtime stored as only time data or as datetime?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data you present makes me beleive datetime:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;BETO wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="jive-rendered-content"&gt;&lt;P&gt;STARTtime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EndTime&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Day_Diff&lt;/P&gt;&lt;P&gt;05:32:00AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10:45:00 AM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;01/26/12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 01/26/12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;STRONG style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;DATA&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; TEST;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; timepart(StartTime) &amp;gt;= &lt;/SPAN&gt;&lt;STRONG style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: teal;"&gt;'08:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: green;"&gt;/*Ticket open after 8PM anyday*/&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp; AND timepart(ENDTime) &amp;lt;= &lt;/SPAN&gt;&lt;STRONG style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: teal;"&gt;'12:00:00PM'T&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: green;"&gt;/*Ticket open after 8PM anyday*/&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp; AND DAY_DIFF &amp;lt; &lt;/SPAN&gt;&lt;STRONG style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: teal;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal"&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: blue;"&gt;THEN&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt; PAY=&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: purple;"&gt;"YES"&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="ecxMsoNormal" style="background-color: #eef4f9;"&gt;&lt;STRONG style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: navy;"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New'; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;&lt;SPAN style="color: #000080; font-family: 'Courier New'; font-weight: 900;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 05:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35064#M8591</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-01-21T05:43:00Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35065#M8592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; FriedEg has provided the solution.&lt;/P&gt;&lt;P&gt;I would add that if you are happy with times like 20:00:00 then use that style and drop the AM / PM. SAS can work out that 21:23:59PM is the same as 21:23:59.&lt;/P&gt;&lt;P&gt;That removes the question of what is intended by 12:00:00PM&amp;nbsp; &lt;/P&gt;&lt;P&gt;Sadly SAS doesn't support the classic solution NOON or MIDNIGHT in time constants not the TIME nor TIMEAMPM formats, but we can construct them with code like&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;format&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;invalue&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; mytime (&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;upcase&lt;/SPAN&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;default&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;32&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 9pt;"&gt;'NOON'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'12:0't&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 9pt;"&gt;'MIDNIGHT'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'00:0't&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; other&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = [&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;time.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; mytime (&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;default&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&lt;/STRONG&gt;12:0't&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp; = &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 9pt;"&gt;'NOON'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; '00:0't&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp; = &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: purple; font-size: 9pt;"&gt;'MIDNIGHT'&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; other&amp;nbsp; = [&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;time8.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; DEMO_times ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;noon = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'12:0:0't&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; time = noon-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; noon+&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;2&amp;nbsp; &lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 9pt;"&gt;/* test NOON and AM/PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&amp;nbsp; noon + &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'0:59:58't&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; noon+&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'1:0:2't&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 9pt;"&gt;/* demo 13:00PM is 1:00PM */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , -&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 9pt;"&gt;/* test MIDNIGHT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'0:59:58't&lt;/STRONG&gt; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;'1:0:2't&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 9pt;"&gt;/* test 12:00 AM to 1:00 AM&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; tim = timepart( time) ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 9pt;"&gt;/* avoid negative time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; xxx = lowcase( put( tim, &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;mytime.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; )) ;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: green; font-size: 9pt;"&gt;/* read lowcase time string ok*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; chk = input( xxx, &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;mytime.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;put&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; tim= &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;mytime.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; chk= &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;timeAMPM.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; chk= &lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: teal; font-size: 9pt;"&gt;mytime.&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: blue; font-size: 9pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-family: 'Courier New'; color: black; font-size: 9pt;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 9pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt; ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jan 2012 14:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35065#M8592</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2012-01-21T14:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35066#M8593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Peter&lt;/P&gt;&lt;P&gt;The question is always: Is midnight the end of a day or the beginning of a new day? Is the time value for midnight '0' or '86400'?&lt;/P&gt;&lt;P&gt;As much as I can see SAS time informats treat midnight as beginning of a new day (= 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way the OP formulated the selection midnight needs to be "end of the day" (=86400)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HMS(24,0,0) will resolve into 86400.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code you've posted still uses a value of '0' for midnight.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2012 02:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35066#M8593</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-01-22T02:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35067#M8594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; First I want to thank you guys for assisting me ... I normally reach out when I hit a wall .&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" class="ecxMsoNormalTable" style="width: 262pt; border-collapse: collapse; margin-left: -0.75pt;" width="349"&gt;&lt;TBODY&gt;&lt;TR style="height: 12.75pt;"&gt;&lt;TD style="padding-left: 5.4pt; width: 48pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="64"&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;startdate&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 59pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="79"&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;starttime&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 48pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="64"&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;date&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 48pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="64"&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;ENDdate&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 59pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="79"&gt;&lt;P class="ecxMsoNormal"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;ENDtime&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 12.75pt;"&gt;&lt;TD style="padding-left: 5.4pt; width: 48pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="64"&gt;&lt;P align="right" class="ecxMsoNormal" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;1/5/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 59pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="79"&gt;&lt;P align="right" class="ecxMsoNormal" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;12:03:00 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 48pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="64"&gt;&lt;P align="right" class="ecxMsoNormal" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;1/5/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 48pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="64"&gt;&lt;P align="right" class="ecxMsoNormal" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;1/5/2012&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding-left: 5.4pt; width: 59pt; padding-right: 5.4pt; height: 12.75pt;" valign="bottom" width="79"&gt;&lt;P align="right" class="ecxMsoNormal" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'MS Sans Serif','serif'; font-size: 10pt;"&gt;10:12:00 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Enclose is&amp;nbsp; a snapshot of the output I don't know if its me not getting it but I tried the example code you all three provided and it work 90% of the time. On the snapshot enclose it should have been a pass. The script&amp;nbsp; looks at Starttime if it falls between 8AM-8PM and its with 4hr or less duration then its a pass that part&amp;nbsp; working fine . The second part is when&amp;nbsp; starttime is&amp;nbsp; after 8PM&amp;nbsp; and endtime 12PM next day that is consider a pass. The EndTime can be between 8PM thru 12PM next day Thats where I've been having my issue&amp;nbsp; with the If and Statement, time&amp;nbsp; since it crosses over to a new day I tried duration time of less than or EQ 12.0 but it looks at the whole&amp;nbsp; day ... Thanks again&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2012 04:29:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35067#M8594</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2012-01-22T04:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35068#M8595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your example the end datetime is before the start datetime.&amp;nbsp; Was that a typo?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it was, as suggested by others, if you have dates and times create a datetime variable.&amp;nbsp; That way you could change your criteria to only look for x number of seconds and not have to build extra logic to account for crossing day boundaries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jan 2012 05:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35068#M8595</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-22T05:34:16Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35069#M8596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Patrick&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect I am in agreement with you, but start with different objectives: &lt;/P&gt;&lt;P&gt;"Midnight" is specific and the only trouble is deciding to which "date" it belongs. Clearly for SAS, in a datetime value, midnight belongs to the following day (0 seconds into the day). The datetime value 86399 is still in 01Jan1960 and one second later&amp;nbsp; datepart(86400) returns the next day. &lt;/P&gt;&lt;P&gt;This is consistent with other SAS interval values which start having the sub-interval= 0 which is another way of saying datetime is "at the start of the interval".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can live with this interpretation that SAS provides - midnight is at the beginning of a day and has time value 0 or 00:00:00. It is the addition of AM or PM to the 12th hour that I find really unhelpful --&amp;gt; it requires more text than the military time and doesn't clarify (for me). For clarity, I would never recommend using AM and PM with time constants. I haven't found anyone unclear about 24hour clock time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps I should enter the modern world of 12PM as it seems I'm very much in a 'midday' minority. &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;and also pay more attention to the OP questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 12:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35069#M8596</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2012-01-25T12:33:44Z</dc:date>
    </item>
    <item>
      <title>If And Not Working</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35070#M8597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thank You Guys for assiting me ... It took awhile but I was able to get what I needed based on your inputs... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jan 2012 17:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-And-Not-Working/m-p/35070#M8597</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2012-01-25T17:25:31Z</dc:date>
    </item>
  </channel>
</rss>

