<?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 INTNX CALCULATION in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885556#M349943</link>
    <description>&lt;PRE&gt;DATE_STATEMENT_START=INTNX("MONTH",DATE_STATEMENT,-1)+DAY(DATE_STATEMENT)-1;&lt;/PRE&gt;
&lt;P&gt;how to interpret this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if DATE_STATEMENT is 20Nov2022&lt;/P&gt;
&lt;P&gt;DATE_STATEMENT_START=20Oct2022+20-1&lt;/P&gt;
&lt;P&gt;and what is the answer?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what if date_statement is 30Nov2022&lt;/P&gt;
&lt;P&gt;what is intnx("MONTH",DATE_STATEMENT,-1) 30Oct2022 or 31Oct2022?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2023 03:46:56 GMT</pubDate>
    <dc:creator>HeatherNewton</dc:creator>
    <dc:date>2023-07-20T03:46:56Z</dc:date>
    <item>
      <title>INTNX CALCULATION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885556#M349943</link>
      <description>&lt;PRE&gt;DATE_STATEMENT_START=INTNX("MONTH",DATE_STATEMENT,-1)+DAY(DATE_STATEMENT)-1;&lt;/PRE&gt;
&lt;P&gt;how to interpret this?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if DATE_STATEMENT is 20Nov2022&lt;/P&gt;
&lt;P&gt;DATE_STATEMENT_START=20Oct2022+20-1&lt;/P&gt;
&lt;P&gt;and what is the answer?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what if date_statement is 30Nov2022&lt;/P&gt;
&lt;P&gt;what is intnx("MONTH",DATE_STATEMENT,-1) 30Oct2022 or 31Oct2022?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 03:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885556#M349943</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-07-20T03:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX CALCULATION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885557#M349944</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Trying to draft an example per your notes.&amp;nbsp; Please try the following and if this is not what you are looking for, shed more light on your goal.&amp;nbsp; Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data Test;&lt;BR /&gt;Date='20NOV2022'd;&lt;BR /&gt;Day=day(date);&lt;BR /&gt;DateNext=intnx('month',Date,-1,'same')+ Day-1; &lt;BR /&gt;format date datenext date9.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc print data=test;&lt;BR /&gt;title "Values for Date, Day and DateNext";&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 04:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885557#M349944</guid>
      <dc:creator>john_mccall</dc:creator>
      <dc:date>2023-07-20T04:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX CALCULATION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885558#M349945</link>
      <description>&lt;P&gt;so if I dont put b or e in intnx("MONTH",DATE_STATEMENT,-1)&lt;/P&gt;
&lt;P&gt;It will always means same date no matter what date_statement is?&lt;/P&gt;
&lt;P&gt;what if 31oct 2022, is it going to give 30sep2022&lt;/P&gt;
&lt;P&gt;and 31mar2022 will give 28feb2022?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and 11oct2022 will give 11sep2022 as same date is assumed...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 04:18:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885558#M349945</guid>
      <dc:creator>HeatherNewton</dc:creator>
      <dc:date>2023-07-20T04:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX CALCULATION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885559#M349946</link>
      <description>&lt;P&gt;&lt;SPAN&gt;If you do not specify the fourth argument 'same' or 's' in intnx('month',Date,-1,&lt;STRONG&gt;'same'&lt;/STRONG&gt;), the date will always be the first day of the month requested.&amp;nbsp; As you indicated, you can type 'e' for end, 'm' for middle, 's' for same, or 'b' for begin which is the default.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 04:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885559#M349946</guid>
      <dc:creator>john_mccall</dc:creator>
      <dc:date>2023-07-20T04:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX CALCULATION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885563#M349948</link>
      <description>&lt;P&gt;As always, Maxim 1: Read the Documentation!&lt;/P&gt;
&lt;P&gt;&lt;A title="INTNX Function" href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p10v3sa3i4kfxfn1sovhi5xzxh8n.htm" target="_blank" rel="noopener"&gt;INTNX Function&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If no fourth argument is specified, the aligment defaults to "BEGINNING", so with a month interval you always get the first of the month. Adding the DAY value and subtracting 1 will result in the same day one month back, with the peculiar twist of what happens when you are at the end of a month with more days than the previous month. If you apply this on July 31, you get July 1 instead of June 30 (which would be the result of INTNX with a SAME alignment) .&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 05:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-CALCULATION/m-p/885563#M349948</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-07-20T05:41:11Z</dc:date>
    </item>
  </channel>
</rss>

