<?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: finding the number of business days in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46754#M9664</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if the holiday function alone will work, because of the day in lieu. Ie Jan 2 is actually the day the stock market was closed this year because Jan 1 was on Sunday. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can program around those things, but still needs to be considered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Feb 2012 22:00:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2012-02-06T22:00:20Z</dc:date>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46741#M9651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SAS Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's assume that the date below consists of business days (for SP500 index downloaded from a finance website for example). We don't have observations for weekends and official holidays in this dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I calculate the number of business days for the preceeding year for each date?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, if current date is 5-Jan-2011 than I need to count back in this data set and find the number of business days between 5-Jan-2010 and 5-Jan-2011. If 5-Jan-2010 is a Saturday, for example, then the counting should be between&amp;nbsp; 7-Jan-2010 and 5-Jan-2011. Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" class="jiveNoBorder" style="width: 79px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="20" style="text-align: center;" width="79"&gt;&lt;STRONG&gt;date&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;4-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;5-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;6-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;7-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;8-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;11-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;12-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;13-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;14-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;15-Jan-2010&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;…&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;3-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;4-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;5-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;6-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;7-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;10-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;11-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;12-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;13-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;14-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20"&gt;17-Jan-2011&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 09:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46741#M9651</guid>
      <dc:creator>bkoksal</dc:creator>
      <dc:date>2012-02-06T09:37:45Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46742#M9652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following code, it uses the combination of intck() and intnx(), plus 'weekday' as interval unit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;input date anydtdte21.;&lt;/P&gt;&lt;P&gt;format date date9.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;4-Jan-2010&lt;/P&gt;&lt;P&gt;5-Jan-2010&lt;/P&gt;&lt;P&gt;6-Jan-2010&lt;/P&gt;&lt;P&gt;7-Jan-2010&lt;/P&gt;&lt;P&gt;8-Jan-2010&lt;/P&gt;&lt;P&gt;11-Jan-2010&lt;/P&gt;&lt;P&gt;12-Jan-2010&lt;/P&gt;&lt;P&gt;13-Jan-2010&lt;/P&gt;&lt;P&gt;14-Jan-2010&lt;/P&gt;&lt;P&gt;15-Jan-2010&lt;/P&gt;&lt;P&gt;3-Jan-2011&lt;/P&gt;&lt;P&gt;4-Jan-2011&lt;/P&gt;&lt;P&gt;5-Jan-2011&lt;/P&gt;&lt;P&gt;6-Jan-2011&lt;/P&gt;&lt;P&gt;7-Jan-2011&lt;/P&gt;&lt;P&gt;10-Jan-2011&lt;/P&gt;&lt;P&gt;11-Jan-2011&lt;/P&gt;&lt;P&gt;12-Jan-2011&lt;/P&gt;&lt;P&gt;13-Jan-2011&lt;/P&gt;&lt;P&gt;14-Jan-2011&lt;/P&gt;&lt;P&gt;17-Jan-2011&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;weekdays=intck('weekday', date,intnx('year',date,-1,'sameday'));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 12:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46742#M9652</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-06T12:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46743#M9653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Haikuo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the attached dates file. When I run the statement you suggested, I get numbers like 261. But for example if you look at 2-jan-1989, the number of business days between 4-jan-1988 and 2-jan-1989 is 253.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe my description of the problem in my original post was not clear, but what I need to find is the number of business days between exactly one year before today and today.&amp;nbsp; (for each date of course).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bülent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 13:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46743#M9653</guid>
      <dc:creator>bkoksal</dc:creator>
      <dc:date>2012-02-06T13:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46744#M9654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to make one point clear though. In my dates file, there are some official holidays. Therefore rather than using the weekday argument in SAS, I need to look back and count the number of days until one year ago.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 13:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46744#M9654</guid>
      <dc:creator>bkoksal</dc:creator>
      <dc:date>2012-02-06T13:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46745#M9655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; You need to create an Interval dataset to define a special interval to use in INTCK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I forget the details exactly but you can find it in the documentation with examples in SAS/ETS UG.&lt;/P&gt;&lt;H1&gt;&lt;A name="a003252593"&gt;INTERVALDS= System Option&lt;/A&gt;&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 13:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46745#M9655</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-06T13:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46746#M9656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, data _null_ has pointed to the right dircection. You need manually acount for the holidays, and set up a dataset for these purpose. 'weekday' can only take care of Mon-Fri, regardless holidays.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 13:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46746#M9656</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-06T13:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46747#M9657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also agree with data_null and am currently investigating the various potential uses of the intervalds option as part of a paper for SGF that FriedEgg, KSharp and I will be presenting at this year's SGF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the real reason I'm replying to your post is that, while hardly mentioned in the documentation, one of the variables you can establish in an interval data set is "cycle".&amp;nbsp; And, once you create such datasets and invoke the intervalds option specifying those datasets, all of the interveral functions appear to be useable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short, I think that either the "cycle" or "season" variables could be used as "weekday" substitutes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 14:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46747#M9657</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-06T14:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46748#M9658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;P&gt;art297 wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also agree with data_null and am currently investigating the various potential uses of the intervalds option as part of a paper for SGF that FriedEgg, KSharp and I will be presenting at this year's SGF.&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Here's and idea for your paper.&amp;nbsp; In a clinical trial subjects can go on and off Investigation Product(IP) the total time on IP is IPRISK, the off time could be thought of as holidays.&amp;nbsp; AE's (there may be thousands) can occur any time during the trial.&amp;nbsp; It is desired to find IPRISK at AE onset call that AERISK.&amp;nbsp; My thought was to create an interval data set to describe the time off IP for each subject.&amp;nbsp; SUBJID becomming the special INTERVAL name. A special interval for every subject.&amp;nbsp; Then it would be easy to calculate AERISK using &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTCK(SUBJID,TRTSTDT,AESTDT); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure the developers of the interval data sets and related functions must have had this example in mind. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 15:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46748#M9658</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-06T15:08:48Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46749#M9659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This post on sascommunity.org will give you a lot of the necessary components to use the intervalds option along with a generated list of holiday's (thanks to the holiday function) in order to build a set of business days which can be used along with intnx function to iterate through operational business days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Generating_Holiday_Lists"&gt;http://www.sascommunity.org/wiki/Generating_Holiday_Lists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The part of the paper which I contributed that Art spoke of in his post is an expansion on this routine that includes Jewish and Islamic holidays based off of there respective luni/solar calendars, and a expansion of the holiday function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 16:25:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46749#M9659</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-02-06T16:25:32Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46750#M9660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;there is one place where I would see this causeing trouble.&amp;nbsp; The intervalds option has a maximum length of, I beleive, 250 characters.&amp;nbsp; This would make defining a custom interval file for each subject very unlikely unless you would process them in very small chunks and keep reassigning the option in a loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 16:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46750#M9660</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-02-06T16:42:25Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46751#M9661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another approach is possible, which is to create your own format using your own "business day" scale.&amp;nbsp; Assuming you have a list of holidays, you would need to create the equivalent of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value busdt today='1'&amp;nbsp; tomorrow='2'&amp;nbsp; nextday='3' etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have already made one key decision, which is if a date falls on a holiday or weekend, it should map to the same outcome as the next (rather than the previous) business day.&amp;nbsp; In that case, the programming will be easier if you work backwards.&amp;nbsp; Start with the final day of the time period you want to measure, equivalent to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;value busdt finalday = '9999'&amp;nbsp; prior day = '9998' etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The details of such a program are complex but relatively short.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The advantage of such a format as that you can save it permanently and use it (relatively) easily:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;interval = input( put(ending_day, busdt.), 4. ) - input( put(starting_day , busdt.), 4.);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using cntlin= data sets, it would be equally plausible to set up a separate format for each subject in a study where the "holidays" vary by subject.&amp;nbsp; The cntlin= data set can generate a separate, permanent format for each subject, using values for FMTNAME like pid001_, pid002_, etc.&amp;nbsp; Using these formats would be a little trickier.&amp;nbsp; You would have to switch from PUT to PUTN, to allow the name of the format to be data-driven based on the patient ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 17:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46751#M9661</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-06T17:03:45Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46752#M9662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is an example in the documentation: &lt;A href="http://support.sas.com/documentation/cdl/en/etsug/63348/HTML/default/viewer.htm#etsug_intervals_sect008.htm"&gt;http://support.sas.com/documentation/cdl/en/etsug/63348/HTML/default/viewer.htm#etsug_intervals_sect008.htm&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example, specifically, is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options intervalds=(BankingDays=BankDayDS);&lt;/P&gt;&lt;P&gt;data BankDayDS(keep=BEGIN);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; start = '15DEC1998'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop&amp;nbsp; = '15JAN2002'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; nwkdays = INTCK('WEEKDAY',start,stop);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do i = 0 to nwkdays;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN = INTNX('WEEKDAY',start,i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year = YEAR(BEGIN);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if BEGIN ne HOLIDAY("NEWYEAR",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("MLK",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("USPRESIDENTS",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("MEMORIAL",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("USINDEPENDENCE",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("LABOR",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("COLUMBUS",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("VETERANS",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("THANKSGIVING",year) and &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEGIN ne HOLIDAY("CHRISTMAS",year) then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format BEGIN DATE.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data CountDays;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; start = '01JAN1999'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop&amp;nbsp; = '31DEC2001'D;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ActualDays = INTCK('DAYS',start,stop);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Weekdays&amp;nbsp;&amp;nbsp; = INTCK('WEEKDAYS',start,stop);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; BankDays&amp;nbsp;&amp;nbsp; = INTCK('BankingDays',start,stop);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; format start stop DATE.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 18:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46752#M9662</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-06T18:50:47Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46753#M9663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I see I think.&amp;nbsp; Each custom interval is define as a separate INTERVALDS so I would need one data set for each subject.&amp;nbsp; I was thinking I could use one INTERVALDS to define all the custom intervals.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wonder if there is a way to trick it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 19:28:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46753#M9663</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-02-06T19:28:02Z</dc:date>
    </item>
    <item>
      <title>Re: finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46754#M9664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if the holiday function alone will work, because of the day in lieu. Ie Jan 2 is actually the day the stock market was closed this year because Jan 1 was on Sunday. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can program around those things, but still needs to be considered.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 22:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46754#M9664</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-02-06T22:00:20Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46755#M9665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since your dataset doesn't have the holidays or weekends you could consider creating a list of distinct dates from that list and a second list of all dates. This will allow you to identify dates that are holidays/weekends and create a lookup table that has all the dates and count of the business days before. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've done this before when constructing dimensions for BI implementations, though I usually hardcode the holiday dates b/c I'm in Canada and the holidays are different and let SAS takes care of weekends. &lt;/P&gt;&lt;P&gt;The lookup table comes in handy for other things as well, ie identifying/grouping quarter, fiscal years, calendar months, etc...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 22:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46755#M9665</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-02-06T22:11:02Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46756#M9666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agreed, but is that a problem with the method or with the dates that have been assigned to the holiday function?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2012 23:22:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46756#M9666</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-06T23:22:31Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46757#M9667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A bit of both? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Holiday function is somewhat ineffective because you have to list all the holidays anyways, what I guess I'd want is a function such as isholiday that takes a date and returns if it's a holiday or day in lieu. The rules for day in lieu are pretty standard for banks so that could be a good starting point. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the method uses the holiday function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might be able to work around that in the solution, but if you have to hardcode things might as well hardcode in the dates IMO.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 00:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46757#M9667</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-02-07T00:04:12Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46758#M9668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All this discussion seems tpo me that it makes the problem more difficult than it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all, for example, in islamic calendar dates of some religious holidays are according to the lunar calendar and they change every day. So it seems not managable to hardcode the dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I imagine that the easiest solution is this. Just download dates for an index from the stock exchange of the country in question. For US, it is SP500, for example. Since the stock exchange is closed for the holidays, there will not be dates for those days. Then use this "dates" dataset to calculate the business days between any two dates. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This approach makes the need to have a list of the holidays redundant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 06:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46758#M9668</guid>
      <dc:creator>bkoksal</dc:creator>
      <dc:date>2012-02-07T06:41:30Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46759#M9669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I meant the dates for holidays in islamic calendar changes every year.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 06:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46759#M9669</guid>
      <dc:creator>bkoksal</dc:creator>
      <dc:date>2012-02-07T06:42:48Z</dc:date>
    </item>
    <item>
      <title>finding the number of business days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46760#M9670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then I'll leave it for the coauthor of our upcomming SGF paper to respond, as he is the one who wrote the code for building an Islamic calendar interval dataset.&amp;nbsp; I don't have any problem with posting it here in advance of SGF, as that way we can get some good tests of the code but, given it is his code, I'll leave the decision up to him.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2012 13:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/finding-the-number-of-business-days/m-p/46760#M9670</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-02-07T13:25:26Z</dc:date>
    </item>
  </channel>
</rss>

