BookmarkSubscribeRSS Feed
olivier_guitton
Calcite | Level 5

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

3 REPLIES 3
Kurt_Bremser
Super User

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;

olivier_guitton
Calcite | Level 5

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

Kurt_Bremser
Super User

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)

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2976 views
  • 0 likes
  • 2 in conversation