<?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 Determining number of months between two date columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720370#M223155</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hello,&lt;/P&gt;&lt;P&gt;I am attempting to determine the months between many observations between two columns: assign_date and completed_date in SAS EG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From other forums I read it looked like the used the intck function, however, it does not work for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed in most of the examples they used the intck function for two specific dates, not dates in columns. Perhaps that's why I am having errors?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=work.'test'n;
var  assign_date due_date;
intck('month', assign_date, completed_date);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Feb 2021 01:10:06 GMT</pubDate>
    <dc:creator>mreynaud</dc:creator>
    <dc:date>2021-02-19T01:10:06Z</dc:date>
    <item>
      <title>Determining number of months between two date columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720370#M223155</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hello,&lt;/P&gt;&lt;P&gt;I am attempting to determine the months between many observations between two columns: assign_date and completed_date in SAS EG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From other forums I read it looked like the used the intck function, however, it does not work for me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed in most of the examples they used the intck function for two specific dates, not dates in columns. Perhaps that's why I am having errors?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=work.'test'n;
var  assign_date due_date;
intck('month', assign_date, completed_date);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2021 01:10:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720370#M223155</guid>
      <dc:creator>mreynaud</dc:creator>
      <dc:date>2021-02-19T01:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Determining number of months between two date columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720376#M223160</link>
      <description>&lt;P&gt;You need to assign the value to a variable.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;MTHS = intck('month', ASSIGN_DATE, COMPLETED_DATE);&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Feb 2021 01:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720376#M223160</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-19T01:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Determining number of months between two date columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720377#M223161</link>
      <description>&lt;P&gt;Since you can't use the intck function in the proc step, I think you should first calculate the value in the data step and then output it in the proc print.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 01:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720377#M223161</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-02-19T01:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Determining number of months between two date columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720379#M223163</link>
      <description>&lt;P&gt;You've got the right function, but ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC PRINT will only print variables that already exist in a data set.&amp;nbsp; It will not print a function derived from other variables.&amp;nbsp; You will have to create a new variable in DATA step creating a new data set.&amp;nbsp; Then print variables from that data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
  set test;
  nmonths=intck('month',assign_date,completed_date);
run;
proc print data=new;
  var assign_date completed_date nmonths;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 01:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720379#M223163</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-02-19T01:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: Determining number of months between two date columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720388#M223169</link>
      <description>&lt;P&gt;Whenever you use INTCK, you have to decide what it is you want to count.&amp;nbsp; If the dates represent 01/31/2021 and 02/02/2021, do you want to count that as 1 month?&amp;nbsp; If so, INTCK is correct (once you follow the suggestions that have been made).&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 03:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720388#M223169</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-02-19T03:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Determining number of months between two date columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720402#M223172</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Whenever you use INTCK, you have to decide what it is you want to count.&amp;nbsp; If the dates represent 01/31/2021 and 02/02/2021, do you want to count that as 1 month?&amp;nbsp; If so, INTCK is correct (once you follow the suggestions that have been made).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Setting the fourth parameter of intck to "C" (=continuous) should return 0 in such cases.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 06:36:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Determining-number-of-months-between-two-date-columns/m-p/720402#M223172</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-19T06:36:15Z</dc:date>
    </item>
  </channel>
</rss>

