<?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: SAS Code to Calculate difference between two dates in number of Days in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277018#M55572</link>
    <description>&lt;P&gt;Were the values actually SAS date value or something like 20160613 and 20141202 (which are NOT SAS date values)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your variables do not contain dates. To get a difference of 20059 from an actual 2DEC2014 date you would need to have 2Nov2069.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try printing some of those values with a format of BEST16. and showing them here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 18:20:58 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-06-13T18:20:58Z</dc:date>
    <item>
      <title>SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277004#M55566</link>
      <description>&lt;P&gt;SAS Code to Calculate difference between two dates in number of Days without use of sas functions like DATDIF and INTCK&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 17:47:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277004#M55566</guid>
      <dc:creator>ykk</dc:creator>
      <dc:date>2016-06-13T17:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277005#M55567</link>
      <description>&lt;P&gt;Without those functions the only thing I would count on being accurate is the difference in days&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Difference = LaterDate - PreviousDate;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want weeks, months or anything else you'll have to write it yourself and is a real waste of time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What can't you use the SAS date functions?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 17:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277005#M55567</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-13T17:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277010#M55570</link>
      <description>&lt;P&gt;I had tried that but it is not accurate giving more days than expected&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:20059&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dates Compared 13-JUN-2016 and 02-DEC-2014&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277010#M55570</guid>
      <dc:creator>ykk</dc:creator>
      <dc:date>2016-06-13T18:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277015#M55571</link>
      <description>&lt;PRE&gt;7 data;&lt;BR /&gt;8 start = '02dec2014'd;&lt;BR /&gt;9 end = '13jun2016'd;&lt;BR /&gt;10 diff = end - start;&lt;BR /&gt;11 put 'diff=' diff;&lt;BR /&gt;12 run;&lt;BR /&gt;&lt;BR /&gt;diff=559&lt;BR /&gt;
&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:11:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277015#M55571</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2016-06-13T18:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277018#M55572</link>
      <description>&lt;P&gt;Were the values actually SAS date value or something like 20160613 and 20141202 (which are NOT SAS date values)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your variables do not contain dates. To get a difference of 20059 from an actual 2DEC2014 date you would need to have 2Nov2069.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try printing some of those values with a format of BEST16. and showing them here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277018#M55572</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-06-13T18:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277029#M55576</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4418"&gt;@ykk﻿&lt;/a&gt;:&amp;nbsp;I suggest you double-check the code which gave you the result 20059 in view of the fact that 20059='02DEC2014'd.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 19:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277029#M55576</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-06-13T19:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277032#M55578</link>
      <description>&lt;P&gt;I was able to get the correct answer i was trying to find the diff in days between a value which is in General date format and current date using date() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had used datepart() on the date value I had got and now I am getting correct answer.Thanks for the help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;date() - datepart(&amp;lt;datevariable&amp;gt;).&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 19:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277032#M55578</guid>
      <dc:creator>ykk</dc:creator>
      <dc:date>2016-06-13T19:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277035#M55579</link>
      <description>&lt;P&gt;Getting a difference in the range of 20,000 when talking about a two year difference in dates make it look like you are taking the difference between two integers that just look to you like they are dates since they happen to be in the range between 20,140,000 and 20,170,000.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try converting the values to dates first and then taking the difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;diff = input(put(date1,8.),yymmdd8.) - input(put(date2,8.),yymmdd8.) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 19:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/277035#M55579</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-06-13T19:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Code to Calculate difference between two dates in number of Days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/426394#M105048</link>
      <description>&lt;P&gt;Hey I have the same problem. How did u solve it? I have a big dataset with over 300 observations and I have the startingdate and the endingdate dd/mm/yyyy and I want to calculate the duration for each observation. Can you write me the code for that? I didnt quite understand it &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you so much! Cheers, Mary&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Code-to-Calculate-difference-between-two-dates-in-number-of/m-p/426394#M105048</guid>
      <dc:creator>marysmith</dc:creator>
      <dc:date>2018-01-10T12:12:51Z</dc:date>
    </item>
  </channel>
</rss>

