Usage Note 31012: An error occurs when a comma is present in the value of a parameter being passed to a macro
ERROR: More positional parameters found than defined.
The following examples illustrate the most common situations that produce this error. This error is caused by commas present in the value of a parameter being passed
to the macro. Because a comma has special significance in a macro parameter list, it must be masked using the appropriate macro quoting FUNCTION.
/*example 1*/
%macro test(value);
%put &value;
%mend;
%test(a,b,c)
/*example 2*/
%macro test(value);
%put &value;
%mend;
%let x=a,b,c;
%test(&x)
In example 1,the compile-time quoting function %STR is needed to mask the comma.
/*example 1*/
%macro test(value);
%put &value;
%mend;
%test(%str(a,b,c))
In example 2, an execution-time function is needed. %BQUOTE can be used to mask the commas in the resolved value of the macro variable X.
/*example 2*/
%macro test(value);
%put &value;
%mend;
%let x=a,b,c;
%test(%bquote(&x))
A good rule to use when deciding between a compile-time FUNCTION and an execution-time quoting function is whether or not you can literally see the problem. If you can see the problem, like in Example 1, then a compile-time FUNCTION is needed (%STR or %NRSTR). In this example, we can see the commas that are causing the problem. If the problem can not be seen, as in example 2, then an execution-time FUNCTION is needed (%BQUOTE or %SUPERQ). We can not see the commas because the parameter's value is the resolved value of a macro variable.
Operating System and Release Information
SAS System | Base SAS | z/OS | | |
OpenVMS VAX | | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
Microsoft Windows XP 64-bit Edition | | |
Microsoft® Windows® for x64 | | |
OS/2 | | |
Microsoft Windows 95/98 | | |
Microsoft Windows 2000 Advanced Server | | |
Microsoft Windows 2000 Datacenter Server | | |
Microsoft Windows 2000 Server | | |
Microsoft Windows 2000 Professional | | |
Microsoft Windows NT Workstation | | |
Microsoft Windows Server 2003 Datacenter Edition | | |
Microsoft Windows Server 2003 Enterprise Edition | | |
Microsoft Windows Server 2003 Standard Edition | | |
Microsoft Windows XP Professional | | |
Windows Millennium Edition (Me) | | |
Windows Vista | | |
64-bit Enabled AIX | | |
64-bit Enabled HP-UX | | |
64-bit Enabled Solaris | | |
ABI+ for Intel Architecture | | |
AIX | | |
HP-UX | | |
HP-UX IPF | | |
IRIX | | |
Linux | | |
Linux on Itanium | | |
OpenVMS Alpha | | |
Solaris | | |
Solaris for x64 | | |
Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Date Modified: | 2008-06-11 14:20:00 |
Date Created: | 2008-01-24 15:27:01 |