<?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 Finding the &amp;quot;time since&amp;quot; in minutes for date and time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-quot-time-since-quot-in-minutes-for-date-and-time/m-p/623274#M183463</link>
    <description>&lt;P&gt;I am trying to find the difference in minutes between two events. I have two variables for time and two variables for dates. I first tried both the INTCK function and FLOOR function, which worked well to find the difference in minutes between my time variables. However, this does not account for date changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, in finding the time between Onset and Randomization:&lt;/P&gt;&lt;P&gt;For Subject 1 -&amp;nbsp;&lt;/P&gt;&lt;P&gt;OnsetDate is 2011-05-15 and OnsetTime is 15:00:00.&amp;nbsp;&lt;/P&gt;&lt;P&gt;RandomizationDate is 2011-05-15 and RandomizationTime is 17:36:00.&lt;/P&gt;&lt;P&gt;This leaves 156 minutes between Onset and Randomization.&lt;/P&gt;&lt;P&gt;For Subject 2 -&amp;nbsp;&lt;/P&gt;&lt;P&gt;OnsetDate is 2011-06-27 and OnsetTime is 21:55:00.&lt;/P&gt;&lt;P&gt;RandomizationDate is 2011-06-28 and RandomizationTime is 00:35:00.&lt;/P&gt;&lt;P&gt;I need a function that can account for this date change when finding the time difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice is much appreciated!&lt;/P&gt;</description>
    <pubDate>Sat, 08 Feb 2020 05:20:44 GMT</pubDate>
    <dc:creator>richaemi</dc:creator>
    <dc:date>2020-02-08T05:20:44Z</dc:date>
    <item>
      <title>Finding the "time since" in minutes for date and time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-quot-time-since-quot-in-minutes-for-date-and-time/m-p/623274#M183463</link>
      <description>&lt;P&gt;I am trying to find the difference in minutes between two events. I have two variables for time and two variables for dates. I first tried both the INTCK function and FLOOR function, which worked well to find the difference in minutes between my time variables. However, this does not account for date changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, in finding the time between Onset and Randomization:&lt;/P&gt;&lt;P&gt;For Subject 1 -&amp;nbsp;&lt;/P&gt;&lt;P&gt;OnsetDate is 2011-05-15 and OnsetTime is 15:00:00.&amp;nbsp;&lt;/P&gt;&lt;P&gt;RandomizationDate is 2011-05-15 and RandomizationTime is 17:36:00.&lt;/P&gt;&lt;P&gt;This leaves 156 minutes between Onset and Randomization.&lt;/P&gt;&lt;P&gt;For Subject 2 -&amp;nbsp;&lt;/P&gt;&lt;P&gt;OnsetDate is 2011-06-27 and OnsetTime is 21:55:00.&lt;/P&gt;&lt;P&gt;RandomizationDate is 2011-06-28 and RandomizationTime is 00:35:00.&lt;/P&gt;&lt;P&gt;I need a function that can account for this date change when finding the time difference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice is much appreciated!&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 05:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-quot-time-since-quot-in-minutes-for-date-and-time/m-p/623274#M183463</guid>
      <dc:creator>richaemi</dc:creator>
      <dc:date>2020-02-08T05:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the "time since" in minutes for date and time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Finding-the-quot-time-since-quot-in-minutes-for-date-and-time/m-p/623280#M183467</link>
      <description>&lt;P&gt;Create complete timestamps (datetime values) out of your variables first:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;onset_ts = dhms(onset_date,0,0,onset_time);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can use intck to find the difference:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;diff_minutes = intck('minute',onset_ts,rand_ts);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or do a simple calculation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;diff_minutes = (rand_ts - onset_ts) / 60;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2020 09:01:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Finding-the-quot-time-since-quot-in-minutes-for-date-and-time/m-p/623280#M183467</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-02-08T09:01:43Z</dc:date>
    </item>
  </channel>
</rss>

