BookmarkSubscribeRSS Feed
Krohn
Obsidian | Level 7

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

9 REPLIES 9
Reeza
Super User

Are your datasets on a server? What does your SAS set up look like?

Krohn
Obsidian | Level 7
SAS Enterprise Guide 6.1
server 9.4
not sure about its setup
Krohn
Obsidian | Level 7
there r many shared datasets in common libraries, online for months/years..im not sure if they've been used on last 6 months, for example
LinusH
Tourmaline | Level 20
In most operating systems there are tools for auditing open files. Check with the SAS server system administrator.

In SAS there are also means to log/audit data set/view/cube usage. But to be effective the SAS administrator must lock down access to data that bypass intelligence server services.

Either way, this will require some substantial effort.

You will have an easier situation if all your would reside in a data base (SAS SPD Server or 3rd party).

What's the use case?
Data never sleeps
Kurt_Bremser
Super User

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;
Krohn
Obsidian | Level 7
i tried it but i got the last modified time with this command, even though ls --help says that means access time
gonna try soon again n carefully
Kurt_Bremser
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 9 replies
  • 4484 views
  • 6 likes
  • 4 in conversation