<?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: More positional parameters found than defined in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746860#M234347</link>
    <description>&lt;P&gt;If your DIR value includes commas then you need to macro quote it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%drive(dir=%str(c:\temp\strange,name),ext=xlsx)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just try adding real quotes. I suspect that the FILENAME() function call will still work with the extra quotes, but not sure about the rest of the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%drive(dir="c:\temp\strange,name",ext=xlsx)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jun 2021 19:11:08 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-06-09T19:11:08Z</dc:date>
    <item>
      <title>More positional parameters found than defined</title>
      <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746847#M234339</link>
      <description>&lt;PRE class="xisDoc-code"&gt;&lt;CODE&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt; I am trying to import multiple excel file on SAS 9.4 using this macros code but kept getting an error which mentioned "More postional parameters found than defined". I was wondering why the error is occuring and how I can fix it? &lt;BR /&gt;&lt;BR /&gt;%macro drive(dir,ext); 
   %local cnt filrf rc did memcnt name; 
   %let cnt=0;          

   %let filrf=mydir;    
   %let rc=%sysfunc(filename(filrf,&amp;amp;dir)); 
   %let did=%sysfunc(dopen(&amp;amp;filrf));
    %if &amp;amp;did ne 0 %then %do;   
   %let memcnt=%sysfunc(dnum(&amp;amp;did));    

    %do i=1 %to &amp;amp;memcnt;              
                       
      %let name=%qscan(%qsysfunc(dread(&amp;amp;did,&amp;amp;i)),-1,.);                    
                    
      %if %qupcase(%qsysfunc(dread(&amp;amp;did,&amp;amp;i))) ne %qupcase(&amp;amp;name) %then %do;
       %if %superq(ext) = %superq(name) %then %do;                         
          %let cnt=%eval(&amp;amp;cnt+1);       
          %put %qsysfunc(dread(&amp;amp;did,&amp;amp;i));  
          proc import datafile="&amp;amp;dir\%qsysfunc(dread(&amp;amp;did,&amp;amp;i))" out=dsn&amp;amp;cnt 
             dbms=xlsx replace;            
          run;          
       %end; 
      %end;  

    %end;
      %end;
  %else %put &amp;amp;dir cannot be opened.;
  %let rc=%sysfunc(dclose(&amp;amp;did));      
             
 %mend drive;
 
%drive(c:\temp,xlsx)&lt;BR /&gt;&lt;BR /&gt;Thank&amp;nbsp;you&amp;nbsp;in&amp;nbsp;advance!&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Jun 2021 18:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746847#M234339</guid>
      <dc:creator>bshiferaw27</dc:creator>
      <dc:date>2021-06-09T18:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: More positional parameters found than defined</title>
      <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746850#M234342</link>
      <description>Show your log and how you called it. I'm assuming you didn't use c:\temp.</description>
      <pubDate>Wed, 09 Jun 2021 18:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746850#M234342</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-06-09T18:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: More positional parameters found than defined</title>
      <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746853#M234344</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I used the pathway to my excel file folder instead of (c:\temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 18:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746853#M234344</guid>
      <dc:creator>bshiferaw27</dc:creator>
      <dc:date>2021-06-09T18:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: More positional parameters found than defined</title>
      <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746860#M234347</link>
      <description>&lt;P&gt;If your DIR value includes commas then you need to macro quote it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%drive(dir=%str(c:\temp\strange,name),ext=xlsx)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just try adding real quotes. I suspect that the FILENAME() function call will still work with the extra quotes, but not sure about the rest of the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%drive(dir="c:\temp\strange,name",ext=xlsx)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 19:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746860#M234347</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-09T19:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: More positional parameters found than defined</title>
      <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746863#M234348</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/349678"&gt;@bshiferaw27&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I used the pathway to my excel file folder instead of (c:\temp)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Be specific, give us the exact path and file name. We can't help you without specifics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, as requested above, SHOW US the entire log for this macro (not just the ERROR messages).&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 19:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746863#M234348</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-06-09T19:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: More positional parameters found than defined</title>
      <link>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746890#M234367</link>
      <description>&lt;P&gt;The single most likely cause of that particular error is more commas used in the call to a macro then when you define. It could be a simple typo such as&lt;/P&gt;
&lt;P&gt;%drive(c:\temp,,xlsx)&amp;nbsp;&amp;nbsp; &amp;lt;=see the &lt;STRONG&gt;2&lt;/STRONG&gt; commas&lt;/P&gt;
&lt;P&gt;or using a parameter that contains one or more commas in the value, quite often in a macro variable you create.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Such as&lt;/P&gt;
&lt;P&gt;%let path= C:\folder\bad,foldernametouse;&lt;/P&gt;
&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ^&amp;nbsp; see the comma?&lt;/P&gt;
&lt;P&gt;%drive (&amp;amp;path, xlsx)&lt;/P&gt;
&lt;P&gt;So the resolved value of the Path variable has a comma and results in 3 macro parameters:&lt;/P&gt;
&lt;P&gt;C:\folder\bad&lt;/P&gt;
&lt;P&gt;foldernametouse&lt;/P&gt;
&lt;P&gt;xlsx&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 20:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/More-positional-parameters-found-than-defined/m-p/746890#M234367</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-09T20:21:02Z</dc:date>
    </item>
  </channel>
</rss>

