<?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: Difference between two dates in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345930#M22892</link>
    <description>&lt;P&gt;Please see:&lt;/P&gt;
&lt;PRE&gt;data example;
   days = intck('weekday1W','02MAR2017'd,'09MAR2017'd);
run;&lt;/PRE&gt;
&lt;P&gt;the weekday1w interval with the intck function considers a week to be six days with Sunday as a weekend day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Mar 2017 19:26:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-03-30T19:26:47Z</dc:date>
    <item>
      <title>Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345906#M22885</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate the difference between two dates but i don't want to take into account Sundays, how can this be done?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eg. Say i'm trying to find the days between March, 2nd and March, 9th; the output should be '6'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greets,&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 18:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345906#M22885</guid>
      <dc:creator>GuillermoPH</dc:creator>
      <dc:date>2017-03-30T18:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345925#M22889</link>
      <description>&lt;P&gt;Note: The following is really&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;'s suggestion, but the system wouldn't let me delete my incorrect post. I hadn't read the request sufficiently and didn't realize that only Sundays were to be excluded. Art T&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the INTCK function. But if you want 6 days given your example, you'll have to add 1. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
  informat date1 date2 date9.;
  input date1 date2;
  dif=INTCK('WEEKDAY1W',date1,date2,'C');
  cards;
02mar2017 09mar2017
24feb2017 09mar2017 
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 19:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345925#M22889</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-30T19:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345926#M22890</link>
      <description>&lt;P&gt;There's probably a short way, but here's the long way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;n_days = 0;&lt;/P&gt;
&lt;P&gt;do i=date1 to date2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if weekday(i) ne 1 then n_days + 1;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;if weekday(date1) &amp;gt; 1 or weekday(date2) &amp;gt; 1 then n_days = n_days - 1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are various ways to count, depending on whether or not&amp;nbsp;the starting date is a Sunday or the ending date is a Sunday.&amp;nbsp; The last line in the program is just one way to account for that.&amp;nbsp; You may want to set up your own rules.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 19:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345926#M22890</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-30T19:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345928#M22891</link>
      <description>&lt;P&gt;I don't know if there's a slicker/more efficient solution, but this is what I'd do. Adjust the end value if you want it to be inclusive of that date. I had to put the -1 to get your desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
    start = '02MAR2017'd;
    end = '09MAR2017'd;
    do i = start to end -1;
        all_cnt + 1;
        non_sunday_cnt + (weekday(i) ne 7);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Mar 2017 19:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345928#M22891</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-30T19:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345930#M22892</link>
      <description>&lt;P&gt;Please see:&lt;/P&gt;
&lt;PRE&gt;data example;
   days = intck('weekday1W','02MAR2017'd,'09MAR2017'd);
run;&lt;/PRE&gt;
&lt;P&gt;the weekday1w interval with the intck function considers a week to be six days with Sunday as a weekend day.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 19:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345930#M22892</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-30T19:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345931#M22893</link>
      <description>&lt;P&gt;I thought about this, but what about saturdays?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 19:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345931#M22893</guid>
      <dc:creator>collinelliot</dc:creator>
      <dc:date>2017-03-30T19:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345936#M22894</link>
      <description>&lt;P&gt;A nice list of the available intervals that can be used with the intck function can be found at:&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003065889.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003065889.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 19:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Difference-between-two-dates/m-p/345936#M22894</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-30T19:35:37Z</dc:date>
    </item>
  </channel>
</rss>

