Restriction: | The COPY statement does not support data set options. |
Tips: | See the example in PROC COPY to migrate from a 32-bit machine
to a 64-bit machine.
The COPY statement defaults to the encoding and data representation
of the output library when you use Remote Library Services (RLS) such
as |
Example: | Manipulating SAS Files |
DATECOPY can be used only when the resulting SAS file uses the V8 or V9 engine.
If the file that you are copying has attributes that require additional processing, the last modified date is changed to the current date. For example, when you copy a data set that has an index, the index must be rebuilt, and the last modified date changes to the current date. Other attributes that require additional processing and that could affect the last modified date include integrity constraints and a sort indicator.
INFO:
- The data sets use different engines, have different variables
or have attributes that might differ.
proc datasets; copy out=dest memtype=data; select vision(memtype=catalog) nutr; run;
/* This step fails! */ proc datasets memtype=(data program); copy out=dest; select apples / memtype=catalog; run;
proc datasets library=work memtype=catalog; copy in=source out=dest; select bodyfat / memtype=data; run;
options validvarname=any; data test; longvar10='aLongVariableName'; retain longvar1-longvar5 0; run; options validvarname=v6; proc copy in=work out=sasuser; select test; run;In this example, LONGVAR10 is truncated to LONGVAR1 and placed in the output data set. Next, the original LONGVAR1 is copied. Its name is no longer unique. Therefore, it is renamed LONGVAR2. The other variables in the input data set are also renamed according to the renaming algorithm. The following example is from the SAS log:
1 options validvarname=any; 2 data test; 3 longvar10='aLongVariableName'; 4 retain longvar1-longvar5 0; 5 run; NOTE: The data set WORK.TEST has 1 observations and 6 variables. NOTE: DATA statement used (Total process time): real time 2.60 seconds cpu time 0.07 seconds 6 7 options validvarname=v6; 8 proc copy in=work out=sasuser; 9 select test; 10 run; NOTE: Copying WORK.TEST to SASUSER.TEST (memtype=DATA). NOTE: The variable name longvar10 has been truncated to longvar1. NOTE: The variable longvar1 now has a label set to longvar10. NOTE: Variable LONGVAR1 already exists on file SASUSER.TEST, using LONGVAR2 instead. NOTE: The variable LONGVAR2 now has a label set to LONGVAR1. NOTE: Variable LONGVAR2 already exists on file SASUSER.TEST, using LONGVAR3 instead. NOTE: The variable LONGVAR3 now has a label set to LONGVAR2. NOTE: Variable LONGVAR3 already exists on file SASUSER.TEST, using LONGVAR4 instead. NOTE: The variable LONGVAR4 now has a label set to LONGVAR3. NOTE: Variable LONGVAR4 already exists on file SASUSER.TEST, using LONGVAR5 instead. NOTE: The variable LONGVAR5 now has a label set to LONGVAR4. NOTE: Variable LONGVAR5 already exists on file SASUSER.TEST, using LONGVAR6 instead. NOTE: The variable LONGVAR6 now has a label set to LONGVAR5. NOTE: There were 1 observations read from the data set WORK.TEST. NOTE: The data set SASUSER.TEST has 1 observations and 6 variables. NOTE: PROCEDURE COPY used (Total process time): real time 13.18 seconds cpu time 0.31 seconds 11 12 proc print data=test; 13 run; ERROR: The value LONGVAR10 is not a valid SAS name. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE PRINT used (Total process time): real time 0.15 seconds cpu time 0.01 seconds