Usage Note 23179: Is there a tool that helps preserve the internal datetime attributes of a SAS data set?
Yes, in Version 8 of the SAS System, the DATECOPY option of the COPY statement provides a copy of the data set that maintains the create and modified dates from the original data set. When DATECOPY is not used, the copy has the current date and time for the created and modified dates. Note that the datetimes referred to are those that are kept internally in the data file. The external datetimes kept by the operating system are not preserved. The DATECOPY option is a good tool to use when converting data sets from Version 6 of the SAS System to data sets that can be used with SAS Version 8.
For unsorted data sets and views without indexes, the datecopy option maintains the values of Created and Last Modified dates equal to the original SAS data files. Data files with a sort assertion set and/or an index will retain the created datetime of the original; however, the modified datetime will reflect the datetime of the COPY operation.
For catalogs, the DATECOPY option has no effect on moddate or crdate. These values will always display the same values as in the original catalog.
For program files, the DATECOPY option has no effect on Last Modified. The Last Modified value always changes based on the elapsed time between the creation of the original file and the time of the COPY operation.
Sample Code
|
libname lib1 'SAS-data-library 1';
libname lib2 'SAS-data-library 2';
proc copy in=sashelp out=lib1 mt=data;
select mdv;run;
ods listing close;
ods output attributes=lib1.atr(keep=label1 cvalue1
where=(label1 in ('Created', 'Last Modified')));
proc contents data=lib1.mdv;run;
ods listing;
title1 "copy of SASHELP.mdv with use of 'datecopy' option";
title2 "created and last modified dates";
proc print data=lib1.atr;run;
proc copy in=sashelp out=lib2 mt=data datecopy;
select mdv;run;
ods listing close;
ods output attributes=lib2.atr(keep=label1 cvalue1
where=(label1 in ('Created', 'Last Modified')));
proc contents data=lib2.mdv;run;
ods listing;
title1 "copy of SASHELP.mdv without use of 'datecopy' option";
title2 "created and last modified dates";
proc print data=lib2.atr;run;
|
Operating System and Release Information
*
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.
| Type: | Usage Note |
| Priority: | low |
| Topic: | SAS Reference ==> Procedures ==> CONTENTS SAS Reference ==> Procedures ==> COPY
|
| Date Modified: | 2008-01-21 15:31:12 |
| Date Created: | 2003-02-20 10:36:35 |