SAS Component Language Dictionary |
Category: | Utility |
Syntax | |
Details | |
Example | |
See Also |
Syntax |
sysrc=COPY(old-name,new-name<,type>); |
contains the return code for the operation:
0 | |
0 |
is the name of the SAS file or catalog entry to copy. This can be a one-, two-, or four-level name and can include SAS data set options.
is the new name for the SAS file or catalog entry. This must be a three- or four-level name if type is 'CATALOG'. If a catalog entry is being copied, the function sets the entry type of the new entry to that of the old entry. You can also specify SAS data set options.
Details |
To copy a catalog entry, specify the complete four-level name of the entry for old-name, a three-level name for new-name, and 'CATALOG' for type.
You can use the WHERE= data set option to copy only those rows that meet a WHERE subset to the new table.
The COPY function does not copy existing integrity constraints to the new SAS table. Use the ICCREATE function to define new integrity constraints.
If the SAS table that is being copied is indexed, then all indexes are rebuilt for the new SAS table. New-name is ignored when you use COPY to copy GRSEG catalog entries that were created using SAS/GRAPH software. A copied GRSEG entry will have either the same name as the original entry or, if an entry with that name already exists in the target catalog, a unique name generated by SAS software.
If a table or catalog with the specified new name already exists, COPY overwrites the existing table or catalog without warning.
Example |
Copy the SAS table DATA1 to DATA2 and copy WORK.TEMP.A.SCL to SASUSER.PROFILE.B.SCL:
if (copy('data1','data2')) then do; _msg_=sysmsg(); ...SCL statements to handle the error condition... end; rc=copy('work.temp.a.scl', 'sasuser.profile.b.scl', 'catalog'); if (rc) then do; _msg_=sysmsg(); ...SCL statements to handle the error condition... end;
Copy from the SAS table SASUSER.CLASS to WORK.CLASS only those rows in which the variable GENDER=M:
if (copy('sasuser.class(where=(GENDER="M"))', 'work.class')) then do; _msg_=sysmsg(); ...SCL statements to handle the error condition... end;
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.