Help using Base SAS procedures

FInd the last updated dataset

Reply
N/A
Posts: 0

FInd the last updated dataset

HI

i have a master table (master_uniq) consitnously we will updaate dataset to that table (50-120 datasets/perday).Now i want the last updated dataset.i have tryed dictionary.vtable also.please let me know
N/A
Posts: 0

Re: FInd the last updated dataset

Hi,

You can find this using proc contents.

You will have a variable called MODATE which gives you last modified date

check with this.

Hope this will help you
Super Contributor
Posts: 474

Re: FInd the last updated dataset

Are you looking ofr the last updated dataset or the last dataset that updated the master table?

For the first, PROC CONTENTS/MODADTE would be a good solution.
You could try also the SYSLAST macro variable which stores the name of the last written dataset.

For the last, you could try to arrange your code to save the desired name on some macro variable, for later processing.

Cheers from Portugal.

Daniel Santos @ www.cgd.pt
N/A
Posts: 0

Re: FInd the last updated dataset

Hi,

You can use the following logic to get the last modified date of a file:

filename inp pipe "ls -g -o ~/&FileName1";
data _null_;
infile inp firstobs=2;
input @24 ModifiedDate $12. ;
if ModifiedDate=" " then stop;
put ModifiedDate= ;
run;

U can pass the list of all files one by one and record the one with the maximum modified date.
Above code is for UNIX,
for windows use: filename inf pipe "dir &FileName1 /t:w /a:-d"; and read from the 6th observation
in format mmddyy8. and time8.
Valued Guide
Posts: 2,175

Re: FInd the last updated dataset

if you update the "master" with PROC APPEND or data step MODIFY, let an AUDIT trail keep the "knowledge".

good luck
PeterC
Ask a Question
Discussion stats
  • 4 replies
  • 251 views
  • 0 likes
  • 3 in conversation