<?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: trouble with sysfunc and intnx in proc sql call in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119580#M24595</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The macro parameter I'm changing was in the dataset b's name, I omitted it for simplicity to clearly show the problem I was having.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought I needed the %sysfunc there to correctly execute the intnx function - I thought it fixed a previous error (the SAS macro language still confuses me) but as you indicated, if I take it out, it works just fine. Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Apr 2013 20:49:08 GMT</pubDate>
    <dc:creator>jab</dc:creator>
    <dc:date>2013-04-24T20:49:08Z</dc:date>
    <item>
      <title>trouble with sysfunc and intnx in proc sql call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119578#M24593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have some basic SAS code that I'm not trying to turn into a macro. I've taken the quotes off of the the first argument to avoid that error, but now I have a new one. &lt;/P&gt;&lt;P&gt;What is wrong with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works just fine:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; create table tester as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; select distinct a.*, b.newvalue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; from datasetabc as a, datasetxyz as b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; where a.id = b.id &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; and month(a.date) = month(intnx('month',b.date,1)) and year(a.date) = year(intnx('month',b.date,1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; order by id, a.date; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;However, when I put it inside a macro, this gives an error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;%macro test_intnx()&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; create table tester as&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; select distinct a.*, b.newvalue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; from datasetabc as a, datasetxyz as b&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; where a.id = b.id &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; and month(a.date) = month(%sysfunc(intnx(month,b.date,1))) and year(a.date) = year(%sysfunc(intnx(month,b.date,1)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;&amp;nbsp; &lt;SPAN style="font-family: 'andale mono', times;"&gt;order by id, a.date; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', times;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%mend();&lt;/P&gt;&lt;P&gt;%test_intnx();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error: &lt;/P&gt;&lt;P&gt;ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number.&lt;/P&gt;&lt;P&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.&amp;nbsp; Execution of &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.&lt;/P&gt;&lt;P&gt;ERROR: Argument 2 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number.&lt;/P&gt;&lt;P&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.&amp;nbsp; Execution of &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %SYSCALL statement or %SYSFUNC or %QSYSFUNC function reference is terminated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 20:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119578#M24593</guid>
      <dc:creator>jab</dc:creator>
      <dc:date>2013-04-24T20:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with sysfunc and intnx in proc sql call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119579#M24594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why are you using %sysfunc in the macro version?&lt;/P&gt;&lt;P&gt;%sysfunc calls works fine when you call it using constants - you cannot pass arguments from the value of a SQL expression.&lt;/P&gt;&lt;P&gt;If your intention is just to put your SQL inside a macro, just skip the %sysfunc.&lt;/P&gt;&lt;P&gt;Why a macro? You are not passing any macro parameters...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 20:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119579#M24594</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-04-24T20:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with sysfunc and intnx in proc sql call</title>
      <link>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119580#M24595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The macro parameter I'm changing was in the dataset b's name, I omitted it for simplicity to clearly show the problem I was having.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought I needed the %sysfunc there to correctly execute the intnx function - I thought it fixed a previous error (the SAS macro language still confuses me) but as you indicated, if I take it out, it works just fine. Thanks. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Apr 2013 20:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/trouble-with-sysfunc-and-intnx-in-proc-sql-call/m-p/119580#M24595</guid>
      <dc:creator>jab</dc:creator>
      <dc:date>2013-04-24T20:49:08Z</dc:date>
    </item>
  </channel>
</rss>

