<?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 difference between dates in months with decimals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421161#M103609</link>
    <description>&lt;P&gt;Okay, thanks for the suggestions. I'd hoped for a procedure or something. But for now I'm going to use this syntax;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
SET have;
months=(end-start)/(365.25/12);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2017 13:12:17 GMT</pubDate>
    <dc:creator>hovliza</dc:creator>
    <dc:date>2017-12-14T13:12:17Z</dc:date>
    <item>
      <title>Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421156#M103605</link>
      <description>&lt;P&gt;Hi! If I want to calculate the difference between months I use this syntax;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*months;
DATA want;
SET have;
months=intck("month", start, end);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But you only get the months without decimals. Is there an easy way to get the months with for example 2 decimals?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 12:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421156#M103605</guid>
      <dc:creator>hovliza</dc:creator>
      <dc:date>2017-12-14T12:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421157#M103606</link>
      <description>&lt;P&gt;Fractions of what? 31-day months, 30-day months, 28- or 29-day months?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd rather use days. A day is a day is a day.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 13:04:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421157#M103606</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-14T13:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421158#M103607</link>
      <description>&lt;P&gt;I guess that depends on how you define the word "easy".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is that decimal months are not really defined; in fact, because some months have 30 days and some months have 31 days and some months have 28 or 29 days, I don't think you will find a unique answer, and I don't think there is anything programmed into SAS that will provide decimal months.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nevertheless, you can create your own definition of decimal months and write data step code to make this happen.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 13:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421158#M103607</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-12-14T13:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421161#M103609</link>
      <description>&lt;P&gt;Okay, thanks for the suggestions. I'd hoped for a procedure or something. But for now I'm going to use this syntax;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
SET have;
months=(end-start)/(365.25/12);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 13:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421161#M103609</guid>
      <dc:creator>hovliza</dc:creator>
      <dc:date>2017-12-14T13:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421185#M103616</link>
      <description>&lt;P&gt;That's both assuming an average for year and for month.&amp;nbsp; How accurate do you need it to be?&amp;nbsp; May not be a suitable calculation for some.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 14:33:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421185#M103616</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-12-14T14:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421206#M103624</link>
      <description>&lt;P&gt;And ignores leap years.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 15:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421206#M103624</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-14T15:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between dates in months with decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421210#M103625</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172388"&gt;@hovliza&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi! If I want to calculate the difference between months I use this syntax;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*months;
DATA want;
SET have;
months=intck("month", start, end);
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you only get the months without decimals. Is there an easy way to get the months with for example 2 decimals?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please describe exactly how you plan on using that fractional month part of the value.&lt;/P&gt;
&lt;P&gt;Anything I have worked on that needed a different interval worked much better by dropping to an actual different interval, either weeks, biweekly period, days or even 5-day periods. That way at least handles 0.1month = one of .28, .29, .30 or .31.&lt;/P&gt;
&lt;P&gt;Note that the intck and intnx&amp;nbsp;functions supports multiples of the interval such as DAY3 or WEEK2 so you can easily specify a consistent period.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2017 15:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculate-difference-between-dates-in-months-with-decimals/m-p/421210#M103625</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-14T15:40:47Z</dc:date>
    </item>
  </channel>
</rss>

