<?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 number of weekdays between two dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21051#M4400</link>
    <description>Hello Brian,&lt;BR /&gt;
&lt;BR /&gt;
This is an idea of a possible solution:&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
  date1="01Oct2010"d;&lt;BR /&gt;
  date2="15Oct2010"d;&lt;BR /&gt;
  do date=date1 to date2;&lt;BR /&gt;
    if 2 le WEEKDAY(date) le 6 then count+1;&lt;BR /&gt;
  end;&lt;BR /&gt;
  format date date1 date2 date9.;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
    <pubDate>Fri, 22 Oct 2010 14:40:13 GMT</pubDate>
    <dc:creator>SPR</dc:creator>
    <dc:date>2010-10-22T14:40:13Z</dc:date>
    <item>
      <title>Calculate the number of weekdays between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21048#M4397</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I need to calculate the number of week days (defined as Monday to Friday) between two dates and am unsure the best way to calculate this.&lt;BR /&gt;
&lt;BR /&gt;
The date range can be between 1 day and 1,095.&lt;BR /&gt;
&lt;BR /&gt;
Any advice would be greatly appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
&lt;BR /&gt;
Brian</description>
      <pubDate>Fri, 22 Oct 2010 12:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21048#M4397</guid>
      <dc:creator>Brian_lewis67</dc:creator>
      <dc:date>2010-10-22T12:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the number of weekdays between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21049#M4398</link>
      <description>Hi:&lt;BR /&gt;
  I'm not sure what you mean by a date range of "1 day and 1,095" -- do you mean the NUMBER of days between 2 dates can have that range but no more and no less or do you mean that the dates range from Jan 2, 1960 ( internal number value 1) to Dec 31, 1962 (1095 internal number value ).&lt;BR /&gt;
&lt;BR /&gt;
  Are your date variables numeric variables or character variables? If you run PROC CONTENTS on your SAS dataset you will be able to tell whether your date variables are character or numeric. It would also be useful to know whether your variables represent the number of DAYS since Jan 1, 1960 (simple date variables) or whether your variables represent the number of SECONDS since midnight on Jan 1, 1960 (a datetime variable).&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 22 Oct 2010 12:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21049#M4398</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-10-22T12:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the number of weekdays between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21050#M4399</link>
      <description>From the SAS Language Dictionary documentation, have a look at using the DATA step function INTCK to count between two dates - weekday is handled with this function (coded as argument1 along with your two SAS DATE numeric variables).&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
count weekdays intck function site:sas.com</description>
      <pubDate>Fri, 22 Oct 2010 14:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21050#M4399</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-10-22T14:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the number of weekdays between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21051#M4400</link>
      <description>Hello Brian,&lt;BR /&gt;
&lt;BR /&gt;
This is an idea of a possible solution:&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
  date1="01Oct2010"d;&lt;BR /&gt;
  date2="15Oct2010"d;&lt;BR /&gt;
  do date=date1 to date2;&lt;BR /&gt;
    if 2 le WEEKDAY(date) le 6 then count+1;&lt;BR /&gt;
  end;&lt;BR /&gt;
  format date date1 date2 date9.;&lt;BR /&gt;
  output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Fri, 22 Oct 2010 14:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21051#M4400</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-10-22T14:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the number of weekdays between two dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21052#M4401</link>
      <description>Hi Brian&lt;BR /&gt;
&lt;BR /&gt;
As Scott suggested:&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  start='07jan2010'd;&lt;BR /&gt;
  do stop=start to '12jan2010'd;&lt;BR /&gt;
    wdvar=intck('weekday17w',start,stop);&lt;BR /&gt;
    put wdvar= @10 start= WEEKDATX. @50 stop= WEEKDATX. /;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Sat, 23 Oct 2010 00:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Calculate-the-number-of-weekdays-between-two-dates/m-p/21052#M4401</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-10-23T00:59:46Z</dc:date>
    </item>
  </channel>
</rss>

