<?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: why is the month interval with shift index not be allowed in function intck()? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679050#M205044</link>
    <description>&lt;P&gt;You want to know how many month boundaries are crossed between date1 and date2.&amp;nbsp; The usual month boundary is crossed when&amp;nbsp; you move from the last day of a calendar month to the 1st day of the next month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you want the boundary crossed only when you move from the 1st day of a calendar month to the 2nd day of the same month.&amp;nbsp; In that case you could count boundaries crossed via:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;nmonths=intck('month',date1-1,date2-1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just subtract 1 day less than the month starting day from both dates. Then the number of calendar months crossed (produced by INTCK) will equal the number of user-specified months.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will work for months declared to begin on the 1st through 28th.&amp;nbsp; But your concept is not adequately defined for months beginning on the 29th through 31th, since some calendar months will not have such dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And that's pretty much the reason that SAS doesn't provide offsets like month.2, month.3, etc - because months do not have a constant number of subunits, whether they are said to be weeks or days.&amp;nbsp; Years however (and semiyears and quarters) always have a constant number of subunits (months).&amp;nbsp; The same goes for weeks (always 7 days).&lt;/P&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;</description>
    <pubDate>Tue, 25 Aug 2020 04:14:28 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-08-25T04:14:28Z</dc:date>
    <item>
      <title>why is the month interval with shift index not be allowed in function intck()?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/678802#M204937</link>
      <description>&lt;P&gt;I run the following code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: Invalid argument to function INTCK('month.3',18992,18993) at 行 76 列 3.&lt;BR /&gt;&lt;CODE class=" language-sas"&gt;data test;
x=intck('day','31dec2011'd,'01jan2012'd);
y=intck('week.2','31dec2011'd,'01jan2012'd);
z=intck('month.3','31dec2011'd,'01jan2012'd);
w=intck('year.2','31dec2011'd,'01jan2012'd);
run;
proc print ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The note in&amp;nbsp; window reads:&lt;/P&gt;
&lt;P&gt;NOTE: Invalid argument to function INTCK('month.3',18992,18993) at line 76 column 3.&lt;/P&gt;
&lt;P&gt;and variable z taken missing value。 why？&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 03:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/678802#M204937</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2020-08-24T03:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: why is the month interval with shift index not be allowed in function intck()?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/678812#M204944</link>
      <description>&lt;P&gt;The question, rather, is:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What did you expect &lt;FONT face="courier new,courier"&gt;month.3&lt;/FONT&gt; to mean?&lt;/P&gt;
&lt;P&gt;Have you read the &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0syn64amroombn14vrdzksh459w.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;documentation&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;You cannot have a shift on month in you count single-month intervals.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 05:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/678812#M204944</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-08-24T05:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: why is the month interval with shift index not be allowed in function intck()?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/678853#M204966</link>
      <description>&lt;P&gt;According to the documentation at &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0syn64amroombn14vrdzksh459w.htm&amp;amp;locale=en#n1wbckrlffgb8jn15eebgjpqm23c"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0syn64amroombn14vrdzksh459w.htm&amp;amp;locale=en#n1wbckrlffgb8jn15eebgjpqm23c&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use any of these:&lt;/P&gt;
&lt;P&gt;MONTH3.2&lt;/P&gt;
&lt;P&gt;MONTH3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but not&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MONTH.3&lt;/P&gt;
&lt;P&gt;(which as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; points out, does not have meaning, it would be selecting the 3rd subdivision of a one month time period which is meaningless)&lt;/P&gt;</description>
      <pubDate>Mon, 24 Aug 2020 11:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/678853#M204966</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-24T11:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: why is the month interval with shift index not be allowed in function intck()?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679025#M205035</link>
      <description>How to set a one-month interval with the second day  in the month as starting boundary, Since the interval name month.2 is meaningless?</description>
      <pubDate>Tue, 25 Aug 2020 01:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679025#M205035</guid>
      <dc:creator>Steve1964</dc:creator>
      <dc:date>2020-08-25T01:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: why is the month interval with shift index not be allowed in function intck()?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679050#M205044</link>
      <description>&lt;P&gt;You want to know how many month boundaries are crossed between date1 and date2.&amp;nbsp; The usual month boundary is crossed when&amp;nbsp; you move from the last day of a calendar month to the 1st day of the next month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you want the boundary crossed only when you move from the 1st day of a calendar month to the 2nd day of the same month.&amp;nbsp; In that case you could count boundaries crossed via:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;nmonths=intck('month',date1-1,date2-1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Just subtract 1 day less than the month starting day from both dates. Then the number of calendar months crossed (produced by INTCK) will equal the number of user-specified months.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will work for months declared to begin on the 1st through 28th.&amp;nbsp; But your concept is not adequately defined for months beginning on the 29th through 31th, since some calendar months will not have such dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And that's pretty much the reason that SAS doesn't provide offsets like month.2, month.3, etc - because months do not have a constant number of subunits, whether they are said to be weeks or days.&amp;nbsp; Years however (and semiyears and quarters) always have a constant number of subunits (months).&amp;nbsp; The same goes for weeks (always 7 days).&lt;/P&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;</description>
      <pubDate>Tue, 25 Aug 2020 04:14:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679050#M205044</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-08-25T04:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: why is the month interval with shift index not be allowed in function intck()?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679121#M205067</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264961"&gt;@Steve1964&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;How to set a one-month interval with the second day in the month as starting boundary, Since the interval name month.2 is meaningless?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It always helps to tell us what you are trying to do. Your original post didn't say this, so we weren't able to help. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt; has given a good solution.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 11:34:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-is-the-month-interval-with-shift-index-not-be-allowed-in/m-p/679121#M205067</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-25T11:34:36Z</dc:date>
    </item>
  </channel>
</rss>

