user1616544
user1616544

Reputation: 11

How to get owners information for sas file in Windows SAS?

Is there a way to find the information about owner of sas file in Windows SAS? I tried the following code But it doesnt give any information about the owner of code.

data info;
   length infoname infoval $300;
   drop rc fid infonum i close;
   rc=filename('abc','C:\c-ae.sas');
   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;

Is there any way I can get information about the owner of the code/file.

Upvotes: 1

Views: 2031

Answers (1)

BellevueBob
BellevueBob

Reputation: 9618

I don't believe you can get the file owner from a SAS file property. However, you can use the Windows DIR command with the /Q switch to discover the owner. For example:

filename x pipe 'dir /q c:\c-ae.sas';
data a;
   infile x firstobs=6 truncover;
   input @1 file_date yymmdd10.
        @13 file_time time8.
            file_size
            file_owner $22.
            file_name $32.;
   format file_date yymmdd10. file_time time8.; 
   output;
   stop;
run;
filename x clear;

The /B switch is supposed to suppress the command header and trailer output, but it does not on my system; hence, using firstobs=6 skips the headers and the stop command skips the rest of the output.

Note that this is really a Windows solution, not really SAS. I'll add the Windows tags in case others can chip in.

Upvotes: 1

Related Questions