Hello,
Is there a way to get the last access of some Data Set?
I know its possible to get last modified date, create date, file size, etc...
Could we know the last day someone opened or read this Data Set, by clicking or using FROM, SET, APPEND, etc?
Thanks
Are your datasets on a server? What does your SAS set up look like?
On which operating system does your SAS run? (Not the EG)
In linux, ls -ul filename will display the last access time.
Try:
filename oscmd pipe "ls -ul &filename";
data acctime;
infile oscmd;
length
perms $10
links 3
user $8
group $8
size 8
month $3
day 3
ytime $5
fname $100
year 3
time 8
;
format
time time5.
acc_time datetime19.
;
input perms links user group size month day ytime fname;
if length(ytime) = 4
then do;
year = input(ytime,4.);
time = 0;
end;
else do;
year = year(date());
time = input(ytime,time5.);
end;
acdate = input(put(day,z2.)!!month!!put(year,z4.),date9.);
acc_time = acdate * 86400 + time;
run;
Reading http://unix.stackexchange.com/questions/8840/last-time-file-opened closely, it may be that your filesystem is mounted with the noatime option, which prevents recording of access times for performance reasons. If your filesystem has mainly SAS data, mounting it without noatime should not be a problem, as with SAS the files are relatively large, and open/close are rare operations compared to file read/write.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.