<?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: Sub-Query not running , INTNX- is there an issue in how i am using this? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925473#M44672</link>
    <description>&lt;P&gt;Please be always specific what's not working - like returning an Error (please share log) or just not returning the expected result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does DateTimeIn store a SAS Date or DateTime value? Same goes for variable compDate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming DateTimeIn stores a datetime and compDate a Date value the expression needs to look like:&lt;/P&gt;
&lt;PRE&gt;WHERE (datepart(t1.DateTimeIn) BETWEEN t2.compDate AND INTNX('month', t2.compDate, 1,'b'))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if these are both SAS DateTime values then you would need to use a datetime directive for intnx()&lt;/P&gt;
&lt;PRE&gt;WHERE (t1.DateTimeIn BETWEEN t2.compDate AND INTNX('DTmonth', t2.compDate, 1,'b'))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_050/proccas/p141r60728rcy7n11uharpge4ayy.htm" target="_self"&gt;INTNX({interval&amp;lt;multiple&amp;gt;&amp;lt;.shift-index&amp;gt;}, start-from, increment&amp;lt;, 'alignment'&amp;gt;)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I would also always add the alignment explicitly. (The default is Beginning which I assume is what you want).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also be aware that that the BETWEEN operator is inclusive meaning the upper boundary (date start of next month) will be included into the selection.&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>Wed, 24 Apr 2024 00:51:05 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2024-04-24T00:51:05Z</dc:date>
    <item>
      <title>Sub-Query not running , INTNX- is there an issue in how i am using this?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925472#M44671</link>
      <description>&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;&lt;PRE&gt;PROC SQL;
SELECT sum(t1.TheoWin) FROM TDCX.vVW_DWH_PTNSlots t1 
JOIN TDCX.vCXComps t2
ON t1.PtnId=t2.ptnid 
WHERE (t1.DateTimeIn BETWEEN t2.compDate AND INTNX('month', t2.compDate, 1))&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Apr 2024 00:26:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925472#M44671</guid>
      <dc:creator>rrmenon</dc:creator>
      <dc:date>2024-04-24T00:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Query not running , INTNX- is there an issue in how i am using this?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925473#M44672</link>
      <description>&lt;P&gt;Please be always specific what's not working - like returning an Error (please share log) or just not returning the expected result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does DateTimeIn store a SAS Date or DateTime value? Same goes for variable compDate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming DateTimeIn stores a datetime and compDate a Date value the expression needs to look like:&lt;/P&gt;
&lt;PRE&gt;WHERE (datepart(t1.DateTimeIn) BETWEEN t2.compDate AND INTNX('month', t2.compDate, 1,'b'))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if these are both SAS DateTime values then you would need to use a datetime directive for intnx()&lt;/P&gt;
&lt;PRE&gt;WHERE (t1.DateTimeIn BETWEEN t2.compDate AND INTNX('DTmonth', t2.compDate, 1,'b'))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/v_050/proccas/p141r60728rcy7n11uharpge4ayy.htm" target="_self"&gt;INTNX({interval&amp;lt;multiple&amp;gt;&amp;lt;.shift-index&amp;gt;}, start-from, increment&amp;lt;, 'alignment'&amp;gt;)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I would also always add the alignment explicitly. (The default is Beginning which I assume is what you want).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also be aware that that the BETWEEN operator is inclusive meaning the upper boundary (date start of next month) will be included into the selection.&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>Wed, 24 Apr 2024 00:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925473#M44672</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-04-24T00:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sub-Query not running , INTNX- is there an issue in how i am using this?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925474#M44673</link>
      <description>&lt;P&gt;If TDCX points to an external database then it's quite possible INTNX won't get translated correctly into that database's SQL dialect. Id suggest trying SQL Passthru if you are reading an external database.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2024 00:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sub-Query-not-running-INTNX-is-there-an-issue-in-how-i-am-using/m-p/925474#M44673</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-04-24T00:47:30Z</dc:date>
    </item>
  </channel>
</rss>

