11-14-2017 03:54 AM - last edited on 11-14-2017 04:17 AM by RW9
May I know how to find the owner of a SAS dataset in SAS codes? Any example? Thanks.
11-14-2017 04:11 AM
What software are you using? In Base SAS this information is not available. If your using one of the DI pakcages or something like that it may be in the metadata. Please post your question in the relevant area and give your thread titles meaningful titles: "SAS Query", or "SAS Macro query" are not good thread titles.
11-14-2017 04:16 AM
What you show there is the operating system information, therefore you need to be able to execute command line syntax to access it:
filename tmp pipe 'dir "c:\temp" /q'; data want; length buff $2000; infile tmp; input; buff=_infile_; run;
Do note however that that information is nothing to SAS, its also very easy to change that kind of information, so any process using that information is inherently flawed. You are better off using a metadata control system like DI or something if you need to track creation/access etc.
11-14-2017 04:56 AM
"Owner" is not very specific
- is it the design owner
- is it (one of) the people who use it
- is it the userid used when physically writing the dataset file
- is it the userid used when registering table metadata
The dataset file format has no information for owner, AFAIK.
How to determine the physical userid depends on the operating system where SAS is used.
11-20-2017 07:04 AM
You can use the "Finfo" (=file information item) function which is offered by SAS:
data info; length infoname infoval $60; drop rc fid infonum i close; rc=filename('abc','physical-filename'); fid=fopen('abc'); infonum=foptnum(fid); do i=1 to infonum; infoname=foptname(fid,i); infoval=finfo(fid,infoname); output; end; close=fclose(fid); run;
Depending on the Operating System (Windows, UNIX, z/Os, etc.) you get some information bits about your DataSet.
For more information: