<?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 How to calculate the difference between two datetimes in minutes? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775312#M39757</link>
    <description>&lt;P&gt;I tried to calculate Diff by doing computed column &amp;gt; Advanced expression and then `datetime() - t1.datetime / 60 `. Diff is actually the difference between SAS_update and DateTime, SAS_Update is just the lastruntime (datetime())&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I got:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andalusia_0-1634707532713.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64870i1085E9AF1BB6ED5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andalusia_0-1634707532713.png" alt="Andalusia_0-1634707532713.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I get a very weird value but I expected &lt;STRONG&gt;Diff&lt;/STRONG&gt; to have value -1 because there is a a difference of -1 minutes between them SAS_update and DateTime...&lt;/P&gt;</description>
    <pubDate>Wed, 20 Oct 2021 05:28:03 GMT</pubDate>
    <dc:creator>Andalusia</dc:creator>
    <dc:date>2021-10-20T05:28:03Z</dc:date>
    <item>
      <title>How to calculate the difference between two datetimes in minutes?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775312#M39757</link>
      <description>&lt;P&gt;I tried to calculate Diff by doing computed column &amp;gt; Advanced expression and then `datetime() - t1.datetime / 60 `. Diff is actually the difference between SAS_update and DateTime, SAS_Update is just the lastruntime (datetime())&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I got:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Andalusia_0-1634707532713.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64870i1085E9AF1BB6ED5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Andalusia_0-1634707532713.png" alt="Andalusia_0-1634707532713.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I get a very weird value but I expected &lt;STRONG&gt;Diff&lt;/STRONG&gt; to have value -1 because there is a a difference of -1 minutes between them SAS_update and DateTime...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Oct 2021 05:28:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775312#M39757</guid>
      <dc:creator>Andalusia</dc:creator>
      <dc:date>2021-10-20T05:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two datetimes in minutes?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775313#M39758</link>
      <description>&lt;P&gt;Use the function &lt;A href="https://documentation.sas.com/doc/de/pgmsascdc/9.4_3.5/lefunctionsref/p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_self"&gt;intck&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Datetime-variables are, without a format, the number of seconds passed from 1Jan1960 to the actual datetime. The function takes care of the details, if you need the difference in minutes, then use "dtminute" as interval.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Oct 2021 05:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775313#M39758</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-10-20T05:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two datetimes in minutes?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775314#M39759</link>
      <description>Could you show an example?</description>
      <pubDate>Wed, 20 Oct 2021 05:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775314#M39759</guid>
      <dc:creator>Andalusia</dc:creator>
      <dc:date>2021-10-20T05:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two datetimes in minutes?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775319#M39760</link>
      <description>Your approach is OK, but you need to add parentheses.  Without them, SAS performs division first, then subtraction.  Use parentheses to force the subtraction to take place first.</description>
      <pubDate>Wed, 20 Oct 2021 06:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775319#M39760</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-10-20T06:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the difference between two datetimes in minutes?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775343#M39769</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/358343"&gt;@Andalusia&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Could you show an example?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;intck('minute',t1.datetime,datetime(),"c")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The "c" (for continuous) means that difference / 60 is used, and not the count of minute boundaries between the two values (90 seconds difference can turn out to be 2 minutes if the default is used).&lt;/P&gt;
&lt;P&gt;For reference, run this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
time = datetime();
rc = sleep (119,1);
diff1 = intck('minute',time,datetime(),"c");
diff2 = intck('minute',time,datetime());
put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Oct 2021 09:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-calculate-the-difference-between-two-datetimes-in-minutes/m-p/775343#M39769</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-10-20T09:42:02Z</dc:date>
    </item>
  </channel>
</rss>

