SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Last Data Set access date - how to get this info/date?

Reply
Occasional Contributor
Posts: 14

Last Data Set access date - how to get this info/date?

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

Super User
Posts: 19,815

Re: Last Data Set access date - how to get this info/date?

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

Occasional Contributor
Posts: 14

Re: Last Data Set access date - how to get this info/date?

SAS Enterprise Guide 6.1
server 9.4
not sure about its setup
Occasional Contributor
Posts: 14

Re: Last Data Set access date - how to get this info/date?

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
Super User
Posts: 5,430

Re: Last Data Set access date - how to get this info/date?

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
Super User
Posts: 7,804

Re: Last Data Set access date - how to get this info/date?

On which operating system does your SAS run? (Not the EG)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 14

Re: Last Data Set access date - how to get this info/date?

Linux
Super User
Posts: 7,804

Re: Last Data Set access date - how to get this info/date?

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;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 14

Re: Last Data Set access date - how to get this info/date?

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
Super User
Posts: 7,804

Re: Last Data Set access date - how to get this info/date?

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 9 replies
  • 925 views
  • 6 likes
  • 4 in conversation