<?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 Find months difference between current month and date from record in a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-months-difference-between-current-month-and-date-from/m-p/674955#M203287</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please can someone help me with the code to find the &lt;U&gt;&lt;STRONG&gt;months difference&lt;/STRONG&gt;&lt;/U&gt; between the current month (i.e. it would be August 2020, but would reflect the current month whenever the code was run) and the "RUN_DATE" variable (which is Numeric and has a DATE9. format)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of records for RUN_DATE is 31MAY2012.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it would be :&lt;/P&gt;&lt;P&gt;Months_difference = month(today's date) - month(RUN_DATE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for the 31MAY2012 example, Months_difference would equal 99 (August 2020 - May 2012).&lt;/P&gt;</description>
    <pubDate>Thu, 06 Aug 2020 11:19:38 GMT</pubDate>
    <dc:creator>Justin9</dc:creator>
    <dc:date>2020-08-06T11:19:38Z</dc:date>
    <item>
      <title>Find months difference between current month and date from record in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-months-difference-between-current-month-and-date-from/m-p/674955#M203287</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please can someone help me with the code to find the &lt;U&gt;&lt;STRONG&gt;months difference&lt;/STRONG&gt;&lt;/U&gt; between the current month (i.e. it would be August 2020, but would reflect the current month whenever the code was run) and the "RUN_DATE" variable (which is Numeric and has a DATE9. format)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of records for RUN_DATE is 31MAY2012.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it would be :&lt;/P&gt;&lt;P&gt;Months_difference = month(today's date) - month(RUN_DATE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for the 31MAY2012 example, Months_difference would equal 99 (August 2020 - May 2012).&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 11:19:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-months-difference-between-current-month-and-date-from/m-p/674955#M203287</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2020-08-06T11:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Find months difference between current month and date from record in a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-months-difference-between-current-month-and-date-from/m-p/674957#M203288</link>
      <description>&lt;P&gt;SAS provides a few functions to deal with date and time intervals, namely &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p10v3sa3i4kfxfn1sovhi5xzxh8n.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;INTNX&lt;/A&gt; (calculates a target from a start and a difference value) and &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p1md4mx2crzfaqn14va8kt7qvfhr.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;INTCK&lt;/A&gt; (calculates a difference between two date or time values).&lt;/P&gt;
&lt;P&gt;So you should try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Months_difference = intck('month',run_date,today());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Study the documentation about the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p1md4mx2crzfaqn14va8kt7qvfhr.htm&amp;amp;locale=en#n1d9sidj5fym4un19eic1j3zx5hh" target="_blank" rel="noopener"&gt;method&lt;/A&gt; modifier.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 11:21:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-months-difference-between-current-month-and-date-from/m-p/674957#M203288</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-06T11:21:34Z</dc:date>
    </item>
  </channel>
</rss>

