Creator of table

Reply
Occasional Contributor
Posts: 5

Creator of table

Hello,

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;

quit;

ods _all_ close;

ods listing;

But, i would like to have the results and know the creator/owner of the table. It's possible ?

Thanks

Olivier

Super User
Posts: 7,444

Re: Creator of table

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;

data ownlist;

infile oscmd;

length

  owner $8

  filname $50

  memname $32

;

input;

owner = scan(_infile_,3," ");

filname = scan(_infile_,9," ");

memname = scan(filname,1,".")

drop filname;

run;

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

Re: Creator of table

Hello !

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.

Thanks

Super User
Posts: 7,444

Re: Creator of table

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

Hey, Scripting Guy! How Can I Use Windows PowerShell to Determine the Owner of a File? - Hey, Scrip...

(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)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 798 views
  • 0 likes
  • 2 in conversation