Date: Tue, 2 Nov 1999 14:20:15 -0500
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: how to preserve the sas dataset date?
Content-Type: text/plain; charset=US-ASCII
There is a distinction to be made between, on the one hand, modifying a
data set, and, on the other hand, replacing a data set with a new data
set having the same name. Even "PROC SORT DATA=WHATEVER;" is implicitly
"PROC SORT DATA=WHATEVER OUT=WHATEVER;" and brings about a replacement.
Besides the MODIFY statement in a DATA step, there are some procedures
which modify in place. The following code demonstrates three (PROC
DATASETS, PROC APPEND, PROC SQL).
data test;
input x y;
cards;
1 2
3 4
;
proc contents data=test; run;
data more;
input x y;
cards;
5 6
;
data _null_; if sleep(120); run;
proc datasets; modify test (label='New Label'); quit;
proc contents data=test; run;
data _null_; if sleep(120); run;
proc append base=test data=more; run;
proc contents data=test; run;
data _null_; if sleep(120); run;
proc sql;
insert into test select * from more;
quit;
proc contents data=test; run;
> Date: Tue, 26 Oct 1999 13:57:49 -0500
> From: Randy Childs <rchilds@BOSTONBIO.COM>
> Subject: Re: how to preserve the sas dataset date?
>
> Be careful in using these dates. I think that the "Date Modified" that
> you get from PROC CONTENTS is not what you might think intuitively. This
> date will only be different from the "Date Created" if you use the
> MODIFY statement in a data step. I'm not sure of the exact structure of
> the code since I don't perform data steps this way and don't want to
> bother looking it up in the manual, but something like
>
> DATA PERM.JUNK;
> MODIFY PERM.JUNK TEMP.JUNK;
> RUN;
>
> Any other method of changing/modifying data set will reset the "Date
> Created". Even something as simple as:
> DATA PERM.JUNK;
> SET PERM.JUNK;
> RUN;
>
> --or--
>
> PROC SORT DATA=PERM.JUNK;
> BY ID;
> RUN;
>
> will reset the Date Created.
>
> Randy Childs
> Statistical Programmer
> Boston Biostatistics, Inc.