<?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: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198100#M266580</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The followings are what I tried,&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let fid=%sysfunc(strip(%sysfunc(scan(%str(&amp;amp;firmid),1,','))));&amp;nbsp; not work&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let fid=%sysfunc(strip(%sysfunc(scan(%bquote(&amp;amp;firmid),1,',')))); this works&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I will be happy to know what happened here &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 13 Aug 2015 17:33:39 GMT</pubDate>
    <dc:creator>SeptemberX</dc:creator>
    <dc:date>2015-08-13T17:33:39Z</dc:date>
    <item>
      <title>ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198096#M266576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am recently learning SAS by doing project for my advisor.&lt;/P&gt;&lt;P&gt;Could anyone can help me figure out what is wrong with my code and how to fix it? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql noprint;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*firmid is a macro var containing values of udbnum from temp*/&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select udbnum &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into: firmid separated by ','&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from temp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I want to refer to elements in firmid using the following code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%let fid=%sysfunc(strip(%sysfunc(scan(&amp;amp;firmid,1,','))));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the real problem, I actually used a loop to scan all the elements in firmid, but the error is the same when I simply put 1,2,3, ... in the scan function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR&lt;/STRONG&gt;: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arguments.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR&lt;/STRONG&gt;: The function STRIP referenced by the %SYSFUNC or %QSYSFUNC macro function has too few&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arguments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will really appreciate it if someone can help. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2015 06:32:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198096#M266576</guid>
      <dc:creator>SeptemberX</dc:creator>
      <dc:date>2015-08-13T06:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198097#M266577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It turned out that I need use %bquote rather than %str to mask those commas in the macro firmid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2015 14:45:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198097#M266577</guid>
      <dc:creator>SeptemberX</dc:creator>
      <dc:date>2015-08-13T14:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198098#M266578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will find when working with macros that you can simplify this drastically using the %scan function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let fid = %scan(&amp;amp;firmid,1,',');&lt;/P&gt;&lt;P&gt;And the macro processor almost never needs "strip" .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2015 15:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198098#M266578</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-13T15:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198099#M266579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting comment considering your original post doesn't show %str in it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you try %scan?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2015 17:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198099#M266579</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-13T17:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198100#M266580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The followings are what I tried,&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let fid=%sysfunc(strip(%sysfunc(scan(%str(&amp;amp;firmid),1,','))));&amp;nbsp; not work&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let fid=%sysfunc(strip(%sysfunc(scan(%bquote(&amp;amp;firmid),1,',')))); this works&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I will be happy to know what happened here &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Aug 2015 17:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198100#M266580</guid>
      <dc:creator>SeptemberX</dc:creator>
      <dc:date>2015-08-13T17:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198101#M266581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let fid = %scan(&amp;amp;firmid,1,&lt;STRONG&gt;%str(,)&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2015 13:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198101#M266581</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-08-15T13:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The function SCAN referenced by the %SYSFUNC or %QSYSFUNC macro function has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198102#M266582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You do not need to resort to %SYSFUNC() to scan since there is a built in macro function %SCAN().&lt;/P&gt;&lt;P&gt;In macro code everything is a string, so there is no need to put quotes around string literals to let the parser know you are representing a string.&lt;/P&gt;&lt;P&gt;There is no need to "strip" macro variables.&amp;nbsp; If for some strange reason you have managed to create a macro variable that has leading and/or trailing unquoted spaces then you can use a simple %LET statement to remove them.&amp;nbsp; %let x=&amp;nbsp;&amp;nbsp; a&amp;nbsp;&amp;nbsp;&amp;nbsp; ; is the same as %let x=a; since the unquoted spaces are ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is easier in macro coding if you do not use a comma as your delimiter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;sql&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; udbnum&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; :firmid separated &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;by&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'|'&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; temp&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; nobs=&amp;amp;sqlobs ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; i=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;nobs ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; fid=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%scan&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(&amp;amp;firmid,&amp;amp;i,|) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Aug 2015 13:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-function-SCAN-referenced-by-the-SYSFUNC-or-QSYSFUNC/m-p/198102#M266582</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-15T13:56:06Z</dc:date>
    </item>
  </channel>
</rss>

