Usage Note 43456: An error occurs when attempting to create an index with the same name of one that already exists
If you attempt to create an index on a data set and there is an existing index by the same name with the same definition, you get the following error.
ERROR: An index named X with the same definition already exists for file
LIB.DSET.DATA.
If you attempt to create an index on a data set that matches the name of an existing index but has a different definition, you get the following error.
ERROR: An existing index named X has a different definition.
If you want to recreate an index that already exists, you must first delete the existing index of the same name.
See sample
43637 for code that illustrates how to determine whether an index exists on a data set.
Operating System and Release Information
SAS System | Base SAS | z/OS | | |
Z64 | | |
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 Server 2003 for x64 | | |
Microsoft Windows Server 2008 | | |
Microsoft Windows Server 2008 for x64 | | |
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.
A composite index named COMP is created on data set TEST. PROC DATASETS attempts to create a composite index named COMP on the same data set with same variables, X, and Y. The second PROC DATASETS attempts to create a composite index named COMP on the same data set but with a different definition (different variables in index).
/* Data set TEST created with a composite index called COMP that includes */
/* variables X and Y */
data test(index=(comp=(x y)));
input x y z;
datalines;
1 2 3
;
run;
/* Attempt to create the same composite index on data set TEST */
proc datasets lib=work ;
modify test;
index create comp=(x y);
quit;
/* Attempt to create an index with the same name but change the definition */
proc datasets lib=work ;
modify test;
index create comp=(x z);
quit;
/* This error occurs when an attempt is made to create the same index that has */
/* already been created on the data set.
ERROR: An index named comp with the same definition already exists for file WORK.TEST2.DATA.
/* This error occurs when an attempt is made to create the same named index that */
/* is already created on the data set but the variables in the index are different. */
ERROR: An existing index named comp has a different definition.
Type: | Usage Note |
Priority: | |
Topic: | SAS Reference ==> DATA Step SAS Reference ==> Data Set Options ==> Miscellaneous
|
Date Modified: | 2011-06-08 15:45:25 |
Date Created: | 2011-06-08 10:34:44 |