02-20-2015 05:43 AM
I use this code to know the size of a table in the data :
ods _all_ close;
ods output members=work.taille;
proc datasets lib=SASDATA mt=data;
ods _all_ close;
But, i would like to have the results and know the creator/owner of the table. It's possible ?
02-20-2015 06:51 AM
AFAIK, SAS does not store the identity of the creator in the dataset metadata. At least sashelp.vtable and dictionary.tables do not show that information.
proc contents does list the Owner Name in its listing output in the Engine/Host Dependent Information section, but you would have to fiddle around with rerouting the output to a file and then interpret that.
Depending on your operating system platform, it would be easier to just do a detailed directory listing and read the original creator from there.
eg on UNIX:
filename oscmd pipe "ls -l directory|grep sas7bdat"; * where directory is the path to your library;
owner = scan(_infile_,3," ");
filname = scan(_infile_,9," ");
memname = scan(filname,1,".")
02-23-2015 03:21 AM
Thanks, SAS is under Windows, the code seems work. But, i haven't enough authorization to pipe access. Maybe only super admin could access to this function.
02-23-2015 03:37 AM
So, you problem looks like this:
SAS does not store the identity of the creator of a dataset on its own.
Said identity is only accessible trough operating system functions
You cannot access the OS functions from SAS
So you either have to get that information outside of SAS, or the SAS admin needs to enable xcmd for you.
Info on getting file owner in windows
(After reading that, I once again am aware how blessed I am to run SAS on a UNIX server; one can clearly see how user security was bolted on sideways very late in the Windows development history)