<?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: Calculating a duration between dates and phasing over months in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483701#M125474</link>
    <description>&lt;P&gt;Post test data in the form of a datastep, not here to type it in.&amp;nbsp; As such this is just an overview:&lt;BR /&gt;1) Expand the dates with a do loop so you have one record per date.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Merge onto this dataset your list of holiday dates.&lt;/P&gt;
&lt;P&gt;3) With this expanded dataset, have a flag which is set for either weekday(date) in (1,7) - i.e. weekends, or if date=merged date then flag as well.&lt;/P&gt;
&lt;P&gt;4) Then summarise the dataset ignoring the records you flagged and multiply by number of working hours per day.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Aug 2018 08:18:00 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-08-03T08:18:00Z</dc:date>
    <item>
      <title>Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483681#M125466</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi Base SAS community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried looking for something similar to this issue but have not succeeded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calculate business&amp;nbsp;working hours (excluding weekends, hopefully holidays&amp;nbsp;too eventually with a list)&amp;nbsp;between two dates in hours and then phase these hours over the months in between these two dates by a task duration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been using a function in Excel [NETWORKDAYS.INTL] that can exclude weekends and also holidays if you provide a list. [There might be a SAS equivalent]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully the below will help you understand my issue. (Assume the end date includes a full&amp;nbsp;working day &amp;amp; 8 working hours a day)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your help in advanced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Data:&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Task&lt;/TD&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;TD&gt;End Date&lt;/TD&gt;&lt;TD&gt;Task Hours&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2/08/2018&lt;/TD&gt;&lt;TD&gt;11/10/2018&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;6/02/2019&lt;/TD&gt;&lt;TD&gt;19/02/2019&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/11/2018&lt;/TD&gt;&lt;TD&gt;5/02/2019&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&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;&lt;P&gt;Calculations that need to happen:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Calculations:&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;Task&lt;/TD&gt;&lt;TD&gt;Start Date&lt;/TD&gt;&lt;TD&gt;End Date&lt;/TD&gt;&lt;TD&gt;Number of Available Days (exclude Weekends)&lt;/TD&gt;&lt;TD&gt;Available Hours (8hrs / Day)&lt;/TD&gt;&lt;TD&gt;Monthly Task Hours&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;2/08/2018&lt;/TD&gt;&lt;TD&gt;31/08/2018&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;176&lt;/TD&gt;&lt;TD&gt;86.3&lt;/TD&gt;&lt;TD&gt;*Calc (176 / Total Hours (176,160,72=408)*200(Task Hours)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1/09/2018&lt;/TD&gt;&lt;TD&gt;30/09/2018&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;160&lt;/TD&gt;&lt;TD&gt;78.4&lt;/TD&gt;&lt;TD&gt;*Calc (160 / Total Hours (176,160,72=408)*200(Task Hours)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;1/10/2018&lt;/TD&gt;&lt;TD&gt;11/10/2018&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;72&lt;/TD&gt;&lt;TD&gt;35.3&lt;/TD&gt;&lt;TD&gt;*Calc (72 / Total Hours (176,160,72=408)*200(Task Hours)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;6/02/2019&lt;/TD&gt;&lt;TD&gt;19/02/2019&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;*Calc (80/80)*30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/11/2018&lt;/TD&gt;&lt;TD&gt;30/11/2018&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;176&lt;/TD&gt;&lt;TD&gt;31.9&lt;/TD&gt;&lt;TD&gt;*Calc (176 / 552 *100(Task Hours)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/12/2018&lt;/TD&gt;&lt;TD&gt;31/12/2018&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;168&lt;/TD&gt;&lt;TD&gt;30.4&lt;/TD&gt;&lt;TD&gt;*Calc (168 / 552 *100(Task Hours)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/01/2019&lt;/TD&gt;&lt;TD&gt;31/01/2019&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;184&lt;/TD&gt;&lt;TD&gt;33.3&lt;/TD&gt;&lt;TD&gt;*Calc (184 / 552 *100(Task Hours)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&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TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/11/2018&lt;/TD&gt;&lt;TD&gt;5/02/2019&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;Jan-19&lt;/TD&gt;&lt;TD&gt;33.3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;1/11/2018&lt;/TD&gt;&lt;TD&gt;5/02/2019&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;Feb-19&lt;/TD&gt;&lt;TD&gt;4.3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 03 Aug 2018 19:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483681#M125466</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-03T19:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483701#M125474</link>
      <description>&lt;P&gt;Post test data in the form of a datastep, not here to type it in.&amp;nbsp; As such this is just an overview:&lt;BR /&gt;1) Expand the dates with a do loop so you have one record per date.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Merge onto this dataset your list of holiday dates.&lt;/P&gt;
&lt;P&gt;3) With this expanded dataset, have a flag which is set for either weekday(date) in (1,7) - i.e. weekends, or if date=merged date then flag as well.&lt;/P&gt;
&lt;P&gt;4) Then summarise the dataset ignoring the records you flagged and multiply by number of working hours per day.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 08:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483701#M125474</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-03T08:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483708#M125476</link>
      <description>&lt;P&gt;Thanks for your reply&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the dataset have for testing. My dates are SAS dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;infile datalines dlm=',';&lt;BR /&gt;input Task $ Start_Date: DDMMYY10. End_Date: DDMMYY10. Task_Hours;&lt;BR /&gt;datalines;&lt;BR /&gt;A,02/08/2018,11/10/2018,200&lt;BR /&gt;B,06/02/2019,19/02/2019,30&lt;BR /&gt;C,01/11/2018,05/02/2019,100&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking of needing to write a function to encapsulate the the holidays dates along with the intck(Weekday,start,end) function. Something which mimics the excel function NETWORKDAYS.&amp;nbsp;Your suggestion of just creating a dataset of holidays would work too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 09:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483708#M125476</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-03T09:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483711#M125478</link>
      <description>&lt;P&gt;So here is an example (its a bit verbose and not optimised - you could for instance look at proc expand to get larger dataset), but should be close to what you want:&lt;/P&gt;
&lt;PRE&gt;data have;
  infile datalines dlm=',';
  input Task $ Start_Date: DDMMYY10. End_Date: DDMMYY10. Task_Hours;
datalines;
A,02/08/2018,11/10/2018,200
B,06/02/2019,19/02/2019,30
C,01/11/2018,05/02/2019,100
;
run;

data hols;
  date='05aug2018'd; output;
  date='08aug2018'd; output;
run;

/* Expand */
data inter;
  set have;
  do date=start_date to end_date;
    output;
  end;
run;

/* Add flag */
proc sql;
  create table inter2 as
  select a.*,
         case when b.date ne . or weekday(a.date) in (1,7) then 1
              else 0 end as flag
  from   inter a
  left join hols b
  on     a.date=b.date;
quit;

/* Summarise based on 8 hours per day where flag ne 1 */
proc sql;
  create table want as
  select task,
         start_date,
         end_date,
         count(*) as days,
         calculated days * 8 as hours
  from   inter2
  group by task,start_date,end_date;
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Aug 2018 09:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483711#M125478</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-03T09:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483762#M125501</link>
      <description>&lt;P&gt;A couple of issues to consider first ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you counting 8 hours per day or 7.5?&amp;nbsp; The total hours in your example aren't multiples of 8.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you count both the starting date and the ending date in the computations?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a solution that counts 8 hours per weekday (ignoring holidays) and includes both the start and end day:&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;total = 0;&lt;/P&gt;
&lt;P&gt;do d = start_date to end_date;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if (1 &amp;lt; weekday(d) &amp;lt; 7) then total + 8;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;drop d;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Holidays is a more complex issue.&amp;nbsp; When pressed to do this, I actually turned the list of holidays into a format to remove some of the complexity from the DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;/P&gt;
&lt;P&gt;value holiday date1='Holiday'&lt;/P&gt;
&lt;P&gt;date2='Holiday'&lt;/P&gt;
&lt;P&gt;date3='Holiday'&lt;/P&gt;
&lt;P&gt;other='Workday';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use unformatted dates (or date literals).&amp;nbsp; Then the DATA step could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;if (1 &amp;lt; weekday(d) &amp;lt; 7) and put(d, holiday.) = 'Workday' then total + 8;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 13:21:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483762#M125501</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-03T13:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483851#M125539</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/207413"&gt;@Go210&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your reply&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the dataset have for testing. My dates are SAS dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;infile datalines dlm=',';&lt;BR /&gt;input Task $ Start_Date: DDMMYY10. End_Date: DDMMYY10. Task_Hours;&lt;BR /&gt;datalines;&lt;BR /&gt;A,02/08/2018,11/10/2018,200&lt;BR /&gt;B,06/02/2019,19/02/2019,30&lt;BR /&gt;C,01/11/2018,05/02/2019,100&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was thinking of needing to write a function to encapsulate the the holidays dates along with the intck(Weekday,start,end) function. Something which mimics the excel function NETWORKDAYS.&amp;nbsp;Your suggestion of just creating a dataset of holidays would work too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Holidays are location dependent. SAS does provide HOLIDAYNAME and HOLIDAYTEST functions that will report if the date is a holiday or specific holiday (many organizations work on some&amp;nbsp;holidays such as Valentines Day, Columbus Day or&amp;nbsp;Veterans&amp;nbsp;day)&amp;nbsp;in the US or Canada. If you need a different list of holidays you can create a data set with the holiday information using the DATEKEYS procedure with locale information so you could specify the locale to test.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 16:27:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483851#M125539</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-03T16:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483904#M125554</link>
      <description>Thanks RW9.&lt;BR /&gt;&lt;BR /&gt;I can come configure this a bit further to assist in the output.</description>
      <pubDate>Fri, 03 Aug 2018 19:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483904#M125554</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-03T19:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483910#M125555</link>
      <description>&lt;P&gt;It's 8 hours a day. The Task duration is an estimate of hours which is spread on the available monthly working hours between the start and end dates of the task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It won't be an exact figure because the available work hours is not always equal to the task duration.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for the proc format idea on the holidays issue. I didn't even consider that.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 20:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/483910#M125555</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-03T20:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a duration between dates and phasing over months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/484226#M125691</link>
      <description>&lt;P&gt;If my start date or end date&amp;nbsp;is missing.... what error control do I have in the Do loop? is it continue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data inter;&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; do date=start_date to end_date;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I will just put an if statement before the loop. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Aug 2018 00:13:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-a-duration-between-dates-and-phasing-over-months/m-p/484226#M125691</guid>
      <dc:creator>Go210</dc:creator>
      <dc:date>2018-08-06T00:13:04Z</dc:date>
    </item>
  </channel>
</rss>

