<?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: Trying to Exclude Negative Time differences in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54203#M11467</link>
    <description>Read this prior post with guidelines for special character conditions.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=27609" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=27609&lt;/A&gt;</description>
    <pubDate>Wed, 22 Dec 2010 17:24:49 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-12-22T17:24:49Z</dc:date>
    <item>
      <title>Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54201#M11465</link>
      <description>I'm trying to exclude negative time differences only when the time goes from somewhere in the 23:00 hour to the 00:00 hour.  I can't seem to get this code right.  Unfortunately, I do not have dates associated with the times or that would solve everything.  Here is the code I'm working with:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
DO I=1 TO 72;&lt;BR /&gt;
IF DECONSET{I} NE . AND (DECONSET{I+1}-DECONSET{I}&amp;lt;=0) AND (DECONSET{I+1}-DECONSET{I} NE .) THEN PUT READER= CUSTOMID= DECONSET{I}= DECONSET{I+1}=;&lt;BR /&gt;
END;&lt;BR /&gt;
&lt;BR /&gt;
I don't want this code to output the times that go from 23:00 to 00:00.  I tried writing in the code to exclude differences less than -83000 when '23:00't&amp;lt;=DECONSET{I}&amp;lt;='23:59't , but that didn't seem to work.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance for your help!&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: statadm&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: statadm

Message was edited by: statadm</description>
      <pubDate>Wed, 22 Dec 2010 17:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54201#M11465</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-12-22T17:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54202#M11466</link>
      <description>skip

Message was edited by: statadm</description>
      <pubDate>Wed, 22 Dec 2010 17:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54202#M11466</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-12-22T17:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54203#M11467</link>
      <description>Read this prior post with guidelines for special character conditions.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?messageID=27609" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?messageID=27609&lt;/A&gt;</description>
      <pubDate>Wed, 22 Dec 2010 17:24:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54203#M11467</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-12-22T17:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54204#M11468</link>
      <description>Thanks Scott, I figured it was something like that.  It is working now.</description>
      <pubDate>Wed, 22 Dec 2010 17:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54204#M11468</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-12-22T17:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54205#M11469</link>
      <description>Does anyone have any idea how I can add something to my code to exclude times that go over the midnight hour?</description>
      <pubDate>Wed, 22 Dec 2010 21:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54205#M11469</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-12-22T21:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54206#M11470</link>
      <description>&amp;gt; I'm trying to exclude negative time differences only&lt;BR /&gt;
&amp;gt; when the time goes from somewhere in the 23:00 hour&lt;BR /&gt;
&amp;gt; to the 00:00 hour.  I can't seem to get this code&lt;BR /&gt;
&amp;gt; right.  Unfortunately, I do not have dates associated&lt;BR /&gt;
&amp;gt; with the times or that would solve everything.  Here&lt;BR /&gt;
&amp;gt; is the code I'm working with:&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; DO I=1 TO 72;&lt;BR /&gt;
&amp;gt; IF DECONSET{I} NE . AND&lt;BR /&gt;
&amp;gt; (DECONSET{I+1}-DECONSET{I} le 0) AND&lt;BR /&gt;
&amp;gt; (DECONSET{I+1}-DECONSET{I} NE .) THEN PUT READER=&lt;BR /&gt;
&amp;gt; CUSTOMID= DECONSET{I}= DECONSET{I+1}=;&lt;BR /&gt;
&amp;gt; END;&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I don't want this code to output the times that go&lt;BR /&gt;
&amp;gt; from 23:00 to 00:00.  I tried writing in the code to&lt;BR /&gt;
&amp;gt; exclude differences less than -83000 when&lt;BR /&gt;
&amp;gt; '23:00't le DECONSET{I} le '23:59't , but that&lt;BR /&gt;
&amp;gt; didn't seem to work.&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Thanks in advance for your help!&lt;BR /&gt;
are we to assume your array DECONSET contains up to 72 times that represent consecutive events and you want to treat over midnight in a proper way so that if difference is negative and prior time is after 11pm then adapt the negative difference into a proper duration over midnight?&lt;BR /&gt;
Instead of testing deconset(i) and using deconset(i+1) I would suggest testing deconset(i+1)&lt;BR /&gt;
something like[pre]array interval(2:72) ;* to keep the calculations; &lt;BR /&gt;
do i=2 to 72 ;&lt;BR /&gt;
 if missing(deconset(i-1)) then continue ;&lt;BR /&gt;
 if missing(deconset(i)) then continue ; * testing both allows occasional gaps;&lt;BR /&gt;
 inter = deconset(i) - deconset(i-1) ;&lt;BR /&gt;
 if inter LT 0 then do ;&lt;BR /&gt;
   if deconset(i) GE '23:0:0't then&lt;BR /&gt;
      inter = inter + '24:0:0't ;&lt;BR /&gt;
   if interval LT 0 then do ;&lt;BR /&gt;
      inter = . ;&lt;BR /&gt;
      put ( deconset(i-1) deconset(i) )(=) ' still negative interval' ; &lt;BR /&gt;
   end ;&lt;BR /&gt;
   interval(i) = inter ;&lt;BR /&gt;
end ;     [/pre] is that helpful?&lt;BR /&gt;
 &lt;BR /&gt;
That measures interval between consecutive pairs which are both non-missing.. &lt;BR /&gt;
An alternative model might measure between the latest and previous non-missing value.  &lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Thu, 23 Dec 2010 09:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54206#M11470</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-12-23T09:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Exclude Negative Time differences</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54207#M11471</link>
      <description>Thanks Peter, I will give this code a try.</description>
      <pubDate>Thu, 23 Dec 2010 15:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-Exclude-Negative-Time-differences/m-p/54207#M11471</guid>
      <dc:creator>statadm</dc:creator>
      <dc:date>2010-12-23T15:22:39Z</dc:date>
    </item>
  </channel>
</rss>

