<?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: Output for 6 month range but no output when extended to 12 months in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866368#M42609</link>
    <description>&lt;P&gt;Whenever you have errors in the log, please show us the ENTIRE log for this code. We need to see the ENTIRE log, every single line, every single character, with nothing removed. Please copy the log as text, and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Mar 2023 10:25:13 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-03-26T10:25:13Z</dc:date>
    <item>
      <title>Output for 6 month range but no output when extended to 12 months</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866367#M42608</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Currently testing a code to pull the end of month data for each month over a 4 year period. Once I have validated my code I will need to pull the data for a few hundred thousand IDs.&lt;BR /&gt;&lt;BR /&gt;The data is being accessed from a historical database which takes a long time to run (this database contains a daily snapshot of all relevant data points for each ID dating back many years). I’m using a pass through query which references imported data containing a sample size of required ID’s to speed up my code.&lt;BR /&gt;&lt;BR /&gt;When I run the data for a six month range, I am able to successfully pull all of the data however when I extend the date range to one year, the output is always null (but the code still runs).&lt;BR /&gt;&lt;BR /&gt;I also keep getting an error in my log “ERROR 180-322: Statement is not valid or it is used out of proper order.” for my 6 month and 12 month code. I’ve validated my 6 month output by pulling the data directly from the historical database and comparing it and it all matches up.&lt;BR /&gt;&lt;BR /&gt;My questions are:&lt;BR /&gt;&lt;BR /&gt;- What could be causing my output to be empty when I extend the date range to one year?&lt;BR /&gt;- The 180-322 error - is there anything in my code causing this? Should I be concerned that it might result in missing data if my current output has been validated and the code seems to work fine.&lt;BR /&gt;&lt;BR /&gt;My code is below (fields and table names changed as I cannot post the real names. End date for 12 month range END = '31DEC2020: 0:0: 0 'D;)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Data _NULL_;&lt;BR /&gt;&lt;BR /&gt;START = '01JAN2020:0: 0: 0 ' D;&lt;BR /&gt;END = '30JUN2020: 0:0: 0 'D;&lt;BR /&gt;format _all_ DDMMYY10.;&lt;BR /&gt;&lt;BR /&gt;ST = PUT (START, DATE9.) ;&lt;BR /&gt;ED = PUT (END, DATE9.) ;&lt;BR /&gt;&lt;BR /&gt;CALL SYMPUT ("ST", ST);&lt;BR /&gt;CALL SYMPUT ("ED", ED) ;&lt;BR /&gt;put (_all_)(/=);&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;%LET START_DATE =%SYSFUNC(INTNX(DAY,”&amp;amp;ST.”D, 0, B), DATE9.);&lt;BR /&gt;&lt;BR /&gt;%LET END_DATE =%SYSFUNC(INTNX(DAY,”&amp;amp;ED.”D, 0, B), DATE9.);&lt;BR /&gt;&lt;BR /&gt;%PUT &amp;amp;START_DATE &amp;amp;END_DATE;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CONNECT TO ORACLE (connection string") ;&lt;BR /&gt;&lt;BR /&gt;CREATE TABLE SAMPLE_TEST_1 AS&lt;BR /&gt;&lt;BR /&gt;SELECT A.* FROM WORK.SAMPLE E&lt;BR /&gt;INNER JOIN&lt;BR /&gt;(SELECT * FROM CONNECTION TO ORACLE ( select&lt;BR /&gt;&lt;BR /&gt;B. START_DATE&lt;BR /&gt;,B. END_DATE&lt;BR /&gt;,B.ID&lt;BR /&gt;,C.PRODUCT&lt;BR /&gt;,D.ENTRYDATE&lt;BR /&gt;&lt;BR /&gt;FROM DATA.TABLE1 B&lt;BR /&gt;&lt;BR /&gt;LEFT JOIN DATA.TABLE2 C ON B.ID = C.ID AND C.END_DATE=B.END_DATE&lt;BR /&gt;LEFT JOIN DATA.TABLE3 D ON B.ID = D.ID AND D.END_DATE=B.END_DATE&lt;BR /&gt;&lt;BR /&gt;WHERE B.END_DATE BETWEEN TO_DATE(%BQUOTE(‘&amp;amp;START_DATE’),’DD-MON-YYYY’) AND TO_DATE(%BQUOTE(&amp;amp;END_DATE’),’DD-MON-YYYY’) ) ) A&lt;BR /&gt;&lt;BR /&gt;ON A.ID = E.ID;&lt;BR /&gt;&lt;BR /&gt;DISCONNECT FROM ORACLE;&lt;BR /&gt;QUIT;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 26 Mar 2023 10:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866367#M42608</guid>
      <dc:creator>Jackie_18</dc:creator>
      <dc:date>2023-03-26T10:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Output for 6 month range but no output when extended to 12 months</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866368#M42609</link>
      <description>&lt;P&gt;Whenever you have errors in the log, please show us the ENTIRE log for this code. We need to see the ENTIRE log, every single line, every single character, with nothing removed. Please copy the log as text, and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 10:25:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866368#M42609</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-03-26T10:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: Output for 6 month range but no output when extended to 12 months</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866370#M42610</link>
      <description>&lt;P&gt;First, make up your mind if you want to work with&amp;nbsp;&lt;EM&gt;dates&lt;/EM&gt; or&amp;nbsp;&lt;EM&gt;datetimes&lt;/EM&gt;.&amp;nbsp;&lt;EM&gt;Date&lt;/EM&gt; literals use the format&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"ddmonyyyy"d&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;without a time component.&lt;/P&gt;
&lt;P&gt;Next, the DAY interval in INTNX with an offset of 0 will simply return the input &lt;EM&gt;date&lt;/EM&gt; value, so the whole function call is useless.&lt;/P&gt;
&lt;P&gt;Next, your code contains multiple "curly" quotes, which are not valid, neither in SAS nor in Oracle. I suspect this happens because you edited code at some time in a word processor instead of a text editor, which is a&amp;nbsp;&lt;STRONG&gt;BAD THING&lt;/STRONG&gt;. Never do that.&lt;/P&gt;
&lt;P&gt;Next, the SAS macro engine will not resolve macro variables inside single quotes.&lt;/P&gt;
&lt;P&gt;Finally, Oracle will not recognize dates in DATE9. format. Database engines usually work with dates formatted as YYYY-MM-DD; I have never seen the ddmonyyyy format outside of SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint:&lt;/P&gt;
&lt;P&gt;First, get your pass-through query to run in the Oracle client. You will then know which code you need to send from SAS. Then, get it to work from within SAS without macro variables. Only then start to make it dynamic.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2023 10:30:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Output-for-6-month-range-but-no-output-when-extended-to-12/m-p/866370#M42610</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-03-26T10:30:41Z</dc:date>
    </item>
  </channel>
</rss>

