<?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: Need to use intnx and other formula and I'm stuck in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527125#M5231</link>
    <description>&lt;P&gt;Instead of telling us "&lt;SPAN&gt;they aren't coming back right", show us (some of) the inputs&amp;nbsp;and show us the outputs so we can know what is happening.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 21:14:48 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-01-14T21:14:48Z</dc:date>
    <item>
      <title>Need to use intnx and other formula and I'm stuck</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527115#M5227</link>
      <description>&lt;P&gt;Scenario - I have a column with a due date.&amp;nbsp; If the month is 10,11 or 12, the due date is December 31st of three years from the due date.&amp;nbsp; If the month due is in months 1-9, it's due on the same day just 39 months from the due date.&amp;nbsp; I had two formulas provided to me but they aren't coming back right:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ifn(MONTH(t1.INACMSA) in (10,11,12), MDY(MONTH(t1.INACMSA),DAY(t1.INACMSA),YEAR(t1.INACMSA)+3),INTNX('MONTH',t1.INACMSA,39,'S'))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ifn(MONTH(&lt;SPAN&gt;t1.INACMSA) IN (10,11,12), MDY(12,31,YEAR(t1.INACMSA)+3),intnx('MONTH',t1.INACMSA,36,'S'))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 20:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527115#M5227</guid>
      <dc:creator>maliksmom2000</dc:creator>
      <dc:date>2019-01-14T20:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need to use intnx and other formula and I'm stuck</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527123#M5229</link>
      <description>&lt;P&gt;Looks like you are trying to do this in SQL - is that right?. If so then I'm not sure if the IFN function will work properly. Using a CASE statement is probably a better approach.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527123#M5229</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-01-14T21:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Need to use intnx and other formula and I'm stuck</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527124#M5230</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you really have date values or datetime values, if datetime then you need to extract the date part from it (datepart() function helps).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ;
format INACMSA date date9.;
INACMSA='12JAN2017'd;
Date=ifn(MONTH(INACMSA) IN (10,11,12),INTNX('YEAR',INACMSA,3,'e'),INTNX('MONTH',INACMSA,39,'s'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:13:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527124#M5230</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2019-01-14T21:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need to use intnx and other formula and I'm stuck</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527125#M5231</link>
      <description>&lt;P&gt;Instead of telling us "&lt;SPAN&gt;they aren't coming back right", show us (some of) the inputs&amp;nbsp;and show us the outputs so we can know what is happening.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527125#M5231</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-14T21:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Need to use intnx and other formula and I'm stuck</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527153#M5236</link>
      <description>&lt;P&gt;Not sure why you're using both MDY and INTNX, I'd probably recommend sticking with the same one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works fine for me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data demo;
format date date9.;
input date date9.;
cards;
01Jan2014
03Jan2018
01Oct2014
31Oct2014
01Nov2015
30Nov2016
01Dec2016
31Dec2017
01Apr2018
30Sep2015
;;;;
run;

proc sql;
create table want as
select *, case when month(date) in (10, 11, 12) then intnx('year', date, 3, 'e')
               else intnx('month', date, 39, 's') end as due_date format=date9.
from demo;
quit;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168338"&gt;@maliksmom2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Scenario - I have a column with a due date.&amp;nbsp; If the month is 10,11 or 12, the due date is December 31st of three years from the due date.&amp;nbsp; If the month due is in months 1-9, it's due on the same day just 39 months from the due date.&amp;nbsp; I had two formulas provided to me but they aren't coming back right:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ifn(MONTH(t1.INACMSA) in (10,11,12), MDY(MONTH(t1.INACMSA),DAY(t1.INACMSA),YEAR(t1.INACMSA)+3),INTNX('MONTH',t1.INACMSA,39,'S'))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ifn(MONTH(&lt;SPAN&gt;t1.INACMSA) IN (10,11,12), MDY(12,31,YEAR(t1.INACMSA)+3),intnx('MONTH',t1.INACMSA,36,'S'))&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 21:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Need-to-use-intnx-and-other-formula-and-I-m-stuck/m-p/527153#M5236</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-01-14T21:54:15Z</dc:date>
    </item>
  </channel>
</rss>

