<?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: calculate the time period in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66888#M19112</link>
    <description>I believe you want "dtminute" not "minute" when working with INTCK and DATETIME variables (as opposed to TIME variables).  If you were to perform the calculation and then use a FORMAT statement for the difference variable, apply a FORMAT to that variable, I believe you would see the incorrect result reflected in the log.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Tue, 25 Aug 2009 18:19:56 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-08-25T18:19:56Z</dc:date>
    <item>
      <title>calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66880#M19104</link>
      <description>I have a variable "TIME", format "DATETIME18."&lt;BR /&gt;
&lt;BR /&gt;
How can I calculate Time1-Time2?&lt;BR /&gt;
For example:&lt;BR /&gt;
&lt;BR /&gt;
19JAN07:22:00:00     -    19JAN07:16:00:00?&lt;BR /&gt;
&lt;BR /&gt;
I try to minus them directly, but I get " 1484863200", useless....&lt;BR /&gt;
&lt;BR /&gt;
Thanks!

Message was edited by: Ken_oy</description>
      <pubDate>Tue, 25 Aug 2009 15:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66880#M19104</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2009-08-25T15:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66881#M19105</link>
      <description>Have you tried applying a DATETIME18. format to the difference?</description>
      <pubDate>Tue, 25 Aug 2009 15:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66881#M19105</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-25T15:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66882#M19106</link>
      <description>It won't work for me. I tried both of the following:&lt;BR /&gt;
(Sorry, mistakes in my code, skip this post pls)&lt;BR /&gt;
--------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
data insulin_l;&lt;BR /&gt;
format ltime datatime18.;&lt;BR /&gt;
set insulin;&lt;BR /&gt;
ltime=lag(ttime);&lt;BR /&gt;
ldose=lag(dose);&lt;BR /&gt;
run;&lt;BR /&gt;
--------------------------------------------------------&lt;BR /&gt;
data insulin_l;&lt;BR /&gt;
set insulin;&lt;BR /&gt;
ltime=lag(ttime);&lt;BR /&gt;
ldose=lag(dose);&lt;BR /&gt;
format ltime datatime18.;&lt;BR /&gt;
run;&lt;BR /&gt;
--------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ken_oy

Message was edited by: Ken_oy</description>
      <pubDate>Tue, 25 Aug 2009 16:04:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66882#M19106</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2009-08-25T16:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66883#M19107</link>
      <description>Well, it that was a literal cut &amp;amp; paste, you need to use dat&lt;B&gt;E&lt;/B&gt;time18 and not "datatime18"</description>
      <pubDate>Tue, 25 Aug 2009 16:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66883#M19107</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-25T16:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66884#M19108</link>
      <description>Sorry, my bad.&lt;BR /&gt;
I am using the following code now&lt;BR /&gt;
--------------------------------------------------&lt;BR /&gt;
data insulin_l;&lt;BR /&gt;
set insulin;&lt;BR /&gt;
ltime=ttime-lag(ttime);&lt;BR /&gt;
ldose=dose-lag(dose);&lt;BR /&gt;
format ltime datetime18.;&lt;BR /&gt;
run;&lt;BR /&gt;
-------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
But the answer is:&lt;BR /&gt;
&lt;BR /&gt;
18JAN07:20:00:00  -   19JAN07:08:00:00&lt;BR /&gt;
&lt;BR /&gt;
=   31DEC59:12:00:00&lt;BR /&gt;
----------------------------------&lt;BR /&gt;
1959??  What I want is the difference between those time points.&lt;BR /&gt;
&lt;BR /&gt;
Thanks, Kmg!</description>
      <pubDate>Tue, 25 Aug 2009 16:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66884#M19108</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2009-08-25T16:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66885#M19109</link>
      <description>Yes, I wasn't thinking this through correctly.&lt;BR /&gt;
&lt;BR /&gt;
Please check out the SAS function INTCK (or DATDIF if you are only interested in the number of days).</description>
      <pubDate>Tue, 25 Aug 2009 16:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66885#M19109</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-25T16:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66886#M19110</link>
      <description>Referencing the SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website, here are some useful reading links on SAS DATE and DATETIME variables.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS(R) 9.2 Language Reference: Concepts&lt;BR /&gt;
About SAS Date, Time, and Datetime Values&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002200738.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
WORKING WITH SAS® DATE AND TIME FUNCTIONS&lt;BR /&gt;
Andrew H. Karp&lt;BR /&gt;
Sierra Information Services, Inc.&lt;BR /&gt;
San Francisco, California USA&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi24/Begtutor/p58-24.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi24/Begtutor/p58-24.pdf&lt;/A&gt;</description>
      <pubDate>Tue, 25 Aug 2009 17:23:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66886#M19110</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-25T17:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66887#M19111</link>
      <description>Thanks everyone!&lt;BR /&gt;
&lt;BR /&gt;
By using:&lt;BR /&gt;
&lt;BR /&gt;
w=intck('minute', ttime, lag(ttime));</description>
      <pubDate>Tue, 25 Aug 2009 17:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66887#M19111</guid>
      <dc:creator>Ken_oy</dc:creator>
      <dc:date>2009-08-25T17:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: calculate the time period</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66888#M19112</link>
      <description>I believe you want "dtminute" not "minute" when working with INTCK and DATETIME variables (as opposed to TIME variables).  If you were to perform the calculation and then use a FORMAT statement for the difference variable, apply a FORMAT to that variable, I believe you would see the incorrect result reflected in the log.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 25 Aug 2009 18:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/calculate-the-time-period/m-p/66888#M19112</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-25T18:19:56Z</dc:date>
    </item>
  </channel>
</rss>

