Problem Note 44766: Recursion within the macro facility may cause a stack overflow error
When assigning a macro variable to itself using CALL SYMPUT and referencing the same macro variable later, an infinite recursion can occur, resulting in a stack overflow.
Example of the error that may occur:
ERROR: Stack overflow detected In Task [ Language Processor ]
Exception occurred at (02501024)
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
02501024 02E3504C sasxshel:mcn_main+0x60024
024A51BE 02E35068 sasxshel:mcn_main+0x41BE
024C6DE6 02E35098 sasxshel:mcn_main+0x25DE6
...
Here is an example of the code that might cause the recursion and the error above:
data _null_;
name='cr';
value='%sysfunc(datepart(&cr),date9.)';
call symputx(name,value,"G");
run;
%put &cr;
The recursion here is the macro variable name cr containing the value of &cr.
There is no current work-around other than removing the recursion.
The correct error in this case should be:
ERROR: The text expression %SYSFUNC(DATEPART(&CR),DATE9.)contains a recursive
reference to the macro variable CR. The macro variable will be assigned
the null value.
Operating System and Release Information
SAS System | Base SAS | z/OS | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows XP 64-bit Edition | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft® Windows® for x64 | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2003 for x64 | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2008 | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows Server 2008 for x64 | 9.2 TS2M3 | 9.4 TS1M0 |
Microsoft Windows XP Professional | 9.2 TS2M3 | 9.4 TS1M0 |
Windows 7 Enterprise 32 bit | 9.2 TS2M3 | |
Windows 7 Enterprise x64 | 9.2 TS2M3 | |
Windows 7 Home Premium 32 bit | 9.2 TS2M3 | |
Windows 7 Home Premium x64 | 9.2 TS2M3 | |
Windows 7 Professional 32 bit | 9.2 TS2M3 | |
Windows 7 Professional x64 | 9.2 TS2M3 | |
Windows 7 Ultimate 32 bit | 9.2 TS2M3 | |
Windows 7 Ultimate x64 | 9.2 TS2M3 | |
Windows Vista | 9.2 TS2M3 | 9.4 TS1M0 |
Windows Vista for x64 | 9.2 TS2M3 | 9.4 TS1M0 |
64-bit Enabled AIX | 9.2 TS2M3 | 9.4 TS1M0 |
64-bit Enabled HP-UX | 9.2 TS2M3 | 9.4 TS1M0 |
64-bit Enabled Solaris | 9.2 TS2M3 | 9.4 TS1M0 |
HP-UX IPF | 9.2 TS2M3 | 9.4 TS1M0 |
Linux | 9.2 TS2M3 | 9.4 TS1M0 |
Linux for x64 | 9.2 TS2M3 | 9.4 TS1M0 |
OpenVMS on HP Integrity | 9.2 TS2M3 | 9.4 TS1M0 |
Solaris for x64 | 9.2 TS2M3 | 9.4 TS1M0 |
*
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.
Creating a macro variable that is equal to itself can cause a stack overflow error.
Type: | Problem Note |
Priority: | low |
Date Modified: | 2011-11-02 16:06:45 |
Date Created: | 2011-10-31 13:19:27 |