<?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: Problem with INTNX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852024#M336790</link>
    <description>&lt;P&gt;First thing, &lt;STRONG&gt;any time&lt;/STRONG&gt; you get an error, provide the LOG with the code and the error(s). Quite often SAS provides diagnostic characters and messages that are actually quite helpful. Copy the text, on the forum open a text box with the &amp;lt;/&amp;gt; icon and paste the text to preserve formatting of the text.&lt;/P&gt;
&lt;P&gt;Such as:&lt;/P&gt;
&lt;PRE&gt;138  %LET QUARTER_START = %SYSFUNC(DEQUOTE(" '%SYSFUNC(INTNX(QTR, '01-JAN-2022'.D, 0, B),
138! DATE11.)' "));
ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not
       a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.  Execution
       of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.

&lt;/PRE&gt;
&lt;P&gt;I have no idea why you are including quotes and the dequote function as that is adding problems. Second, there is no dot in a date value. Consider:&lt;/P&gt;
&lt;PRE&gt;%LET QUARTER_START = %SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, B), DATE11.);
%put Quarter_start is &amp;amp;quarter_start.;
&lt;/PRE&gt;
&lt;P&gt;Second, if you want to know the number of days then there is no need to create formatted values as that will just add complexity to anything resembling an Intck call or subtraction&lt;/P&gt;
&lt;PRE&gt;%let days= %eval( %SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, E))-%SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, B)) );
%put Days is &amp;amp;days.;&lt;BR /&gt;/* or */&lt;BR /&gt;%let days2= %sysfunc(intck(day, %SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, b)),%SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, e))));&lt;BR /&gt;%put Days2 is &amp;amp;days2.;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;Though you may want to consider where the ends actually belong for the total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2023 20:50:58 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-01-03T20:50:58Z</dc:date>
    <item>
      <title>Problem with INTNX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852022#M336788</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I am running the following queries to get '01-JAN-2022' and&amp;nbsp; '31-MAR-2022' as the first and last day of the first quarter of 2022 (which will be used later to find the number of the days in that quarter - I will use a loop to find each quarter number of days)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET QUARTER_START = %SYSFUNC(DEQUOTE(" '%SYSFUNC(INTNX(QTR, '01-JAN-2022'.D, 0, B), DATE11.)' "));&lt;/P&gt;&lt;P&gt;%LET QUARTER_END&amp;nbsp; &amp;nbsp; = %SYSFUNC(DEQUOTE(" '%SYSFUNC(INTNX(QTR, '01-JAN-2022'.D, 0, E), DATE11.)' "));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, these do not work and return an error. I was wondering if you could share your insights on this issue. Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 20:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852022#M336788</guid>
      <dc:creator>Emoji</dc:creator>
      <dc:date>2023-01-03T20:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with INTNX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852023#M336789</link>
      <description>&lt;P&gt;Why so complicated?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let quarter_start = %sysfunc(intnx(qtr,'01jan2022'd,0,b));
%let quarter_end = %sysfunc(intnx(qtr,'01jan2022'd,0,e));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro variables can be used in place of any SAS date value in calculations and comparisons.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 20:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852023#M336789</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-03T20:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with INTNX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852024#M336790</link>
      <description>&lt;P&gt;First thing, &lt;STRONG&gt;any time&lt;/STRONG&gt; you get an error, provide the LOG with the code and the error(s). Quite often SAS provides diagnostic characters and messages that are actually quite helpful. Copy the text, on the forum open a text box with the &amp;lt;/&amp;gt; icon and paste the text to preserve formatting of the text.&lt;/P&gt;
&lt;P&gt;Such as:&lt;/P&gt;
&lt;PRE&gt;138  %LET QUARTER_START = %SYSFUNC(DEQUOTE(" '%SYSFUNC(INTNX(QTR, '01-JAN-2022'.D, 0, B),
138! DATE11.)' "));
ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not
       a number.
ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.  Execution
       of %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.

&lt;/PRE&gt;
&lt;P&gt;I have no idea why you are including quotes and the dequote function as that is adding problems. Second, there is no dot in a date value. Consider:&lt;/P&gt;
&lt;PRE&gt;%LET QUARTER_START = %SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, B), DATE11.);
%put Quarter_start is &amp;amp;quarter_start.;
&lt;/PRE&gt;
&lt;P&gt;Second, if you want to know the number of days then there is no need to create formatted values as that will just add complexity to anything resembling an Intck call or subtraction&lt;/P&gt;
&lt;PRE&gt;%let days= %eval( %SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, E))-%SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, B)) );
%put Days is &amp;amp;days.;&lt;BR /&gt;/* or */&lt;BR /&gt;%let days2= %sysfunc(intck(day, %SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, b)),%SYSFUNC(INTNX(QTR,'01JAN2022'D, 0, e))));&lt;BR /&gt;%put Days2 is &amp;amp;days2.;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;Though you may want to consider where the ends actually belong for the total.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 20:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852024#M336790</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-01-03T20:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with INTNX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852028#M336792</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/314145"&gt;@Emoji&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am running the following queries to get '01-JAN-2022' and&amp;nbsp; '31-MAR-2022' as the first and last day of the first quarter of 2022 (which will be used later to find the number of the days in that quarter - I will use a loop to find each quarter number of days)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the number of days in a quarter, why would you use a loop, when subtraction works fine? Adding on to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; 's answer, you can do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let days_in_quarter=%eval(&amp;amp;quarter_end-&amp;amp;quarter_start+1);&lt;/CODE&gt;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 21:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852028#M336792</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-01-03T21:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with INTNX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852040#M336797</link>
      <description>Thanks a lot. It worked.</description>
      <pubDate>Tue, 03 Jan 2023 23:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-with-INTNX/m-p/852040#M336797</guid>
      <dc:creator>Emoji</dc:creator>
      <dc:date>2023-01-03T23:16:00Z</dc:date>
    </item>
  </channel>
</rss>

