Usage Note 49727: Using the INSERT statement within the SQL procedure does not permit correlation with the table being inserted into
Inserting rows into an existing table using the SQL procedure produces errors when a variable being referenced in the SELECT clause does not exist in the table being referenced in the FROM clause. Errors similar to the following occur:
ERROR: INSERT statement does not permit correlation with the table being inserted into.
ERROR: The reference to xx appears to refer to a variable in the table being inserted into.
For example, the table DS1 contains the variables ID, NAME, ADDRESS, PHONE, and XX. Whereas the table DS2 contains the variables ID, NAME, ADDRESS, and PHONE. Running the following code would produce the errors:
proc sql;
insert into ds1
select id, name, address, phone, xx
from ds2;
quit;
Because the variable XX does not exist in the table DS2, and the INSERT statement does not allow correlation with the table being inserted into, the reference to the variable XX results in errors. The following code would prevent the errors from occurring:
proc sql;
insert into ds1(id, name, address, phone)
select id, name, address, phone
from ds2;
quit;
Operating System and Release Information
SAS System | Base SAS | z/OS | | |
Z64 | | |
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 8 Ent | | |
Microsoft Windows 8 Pro | | |
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 Server 2003 for x64 | | |
Microsoft Windows Server 2008 | | |
Microsoft Windows Server 2008 for x64 | | |
Microsoft Windows Server 2012 Datacenter | | |
Microsoft Windows Server 2012 Std | | |
Microsoft Windows XP Professional | | |
Windows 7 Enterprise 32 bit | | |
Windows 7 Enterprise x64 | | |
Windows 7 Home Premium 32 bit | | |
Windows 7 Home Premium x64 | | |
Windows 7 Professional 32 bit | | |
Windows 7 Professional x64 | | |
Windows 7 Ultimate 32 bit | | |
Windows 7 Ultimate x64 | | |
Windows Millennium Edition (Me) | | |
Windows Vista | | |
Windows Vista for x64 | | |
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 for x64 | | |
Linux on Itanium | | |
OpenVMS Alpha | | |
OpenVMS on HP Integrity | | |
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: | 2013-05-03 10:33:10 |
Date Created: | 2013-04-24 10:45:03 |