<?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 INTCK SAS function in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760435#M30289</link>
    <description>&lt;P&gt;I have the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input mydate1 :yymmdd10. mydate2 :yymmdd10.;
format mydate1 mydate2 yymmddd10.;
datalines;

2020-08-27 2020-10-22
2020-03-01 2020-04-26
;
run;

data want2;
set want;
diff_months=intck("month",mydate1,mydate2);
diff_days=intck("day",mydate1,mydate2);
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which provides the dataset want2&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tSAS1_0-1628531748815.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62417iACC8FE76BAC9E9E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tSAS1_0-1628531748815.png" alt="tSAS1_0-1628531748815.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I don't know why I don't have same diff_months=1 for both rows, since we have the same diff_days !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Aug 2021 17:56:57 GMT</pubDate>
    <dc:creator>tSAS1</dc:creator>
    <dc:date>2021-08-09T17:56:57Z</dc:date>
    <item>
      <title>INTCK SAS function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760435#M30289</link>
      <description>&lt;P&gt;I have the code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input mydate1 :yymmdd10. mydate2 :yymmdd10.;
format mydate1 mydate2 yymmddd10.;
datalines;

2020-08-27 2020-10-22
2020-03-01 2020-04-26
;
run;

data want2;
set want;
diff_months=intck("month",mydate1,mydate2);
diff_days=intck("day",mydate1,mydate2);
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which provides the dataset want2&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tSAS1_0-1628531748815.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62417iACC8FE76BAC9E9E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tSAS1_0-1628531748815.png" alt="tSAS1_0-1628531748815.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I don't know why I don't have same diff_months=1 for both rows, since we have the same diff_days !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 17:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760435#M30289</guid>
      <dc:creator>tSAS1</dc:creator>
      <dc:date>2021-08-09T17:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK SAS function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760438#M30290</link>
      <description>&lt;P&gt;In row one, the dates&amp;nbsp; cross two month boundaries. In row two, the dates cross one month boundary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you want to use the 'C' method of the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_self"&gt;INTCK function&lt;/A&gt; which then counts months from the starting date, rather than crossing a boundary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;diff_months=intck("month",mydate1,mydate2,'c');&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Aug 2021 18:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760438#M30290</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-09T18:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: INTCK SAS function</title>
      <link>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760439#M30291</link>
      <description>&lt;P&gt;Because INTCK counts the number of interval boundaries that are crossed, not a calculation of number of months which actually doesn't have a unique definition. Would a month be like February, 28 or 29 days or like December with 31 days?&amp;nbsp; A 'month' doesn't have a standard definition so it's not a great unit of measure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the doc:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Returns the &lt;STRONG&gt;number of interval boundaries of a given kind that lie between two dates&lt;/STRONG&gt;, times, or datetime values.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So your first record starts in Month = 8 and ends in Month = 10 which is two boundaries crossed, 9 and 10. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In your second record, Month =3and ends in Month = 4 which is a single boundary crossed.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Some references for further details:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1md4mx2crzfaqn14va8kt7qvfhr.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p1md4mx2crzfaqn14va8kt7qvfhr.htm&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/05/15/intck-intnx-intervals-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/05/15/intck-intnx-intervals-sas.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here's a great, but longer and in depth, reference for dates and times in SAS&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/335492"&gt;@tSAS1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have the code below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input mydate1 :yymmdd10. mydate2 :yymmdd10.;
format mydate1 mydate2 yymmddd10.;
datalines;

2020-08-27 2020-10-22
2020-03-01 2020-04-26
;
run;

data want2;
set want;
diff_months=intck("month",mydate1,mydate2);
diff_days=intck("day",mydate1,mydate2);
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which provides the dataset want2&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tSAS1_0-1628531748815.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62417iACC8FE76BAC9E9E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tSAS1_0-1628531748815.png" alt="tSAS1_0-1628531748815.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but I don't know why I don't have same diff_months=1 for both rows, since we have the same diff_days !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 18:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/INTCK-SAS-function/m-p/760439#M30291</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-09T18:08:56Z</dc:date>
    </item>
  </channel>
</rss>

