BookmarkSubscribeRSS Feed
Angel_Saenz
Quartz | Level 8
I need some way to show all the datasets of a library showing the access permission of each dataset
like but adding access permission:

proc datasets library=inf;

run;

 

like:

# Name Member Type File Size Last Modified Access Permission
1 DS1 DATA 2MB 10/22/2018 12:54:50 rw-rw-r--
2 DS2 DATA 1MB 10/22/2018 12:54:50 rw-rw-r--
3 DS3 DATA 1MB 10/22/2018 12:54:50 rw-rw-r--

 

Is it possible? thanks

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Perhaps the dictionary.table_constraints can be of help?

 

proc sql;
   create table test as
   select * from dictionary.table_constraints
   where libname='SomeLibname';
quit;
Kurt_Bremser
Super User

My preferred method is to use an external command to retrieve the information:

%let library=sasuser;

%let library_path=%sysfunc(pathname(&library));

filename dirlist pipe "ls -l &library_path/";

data attributes;
label
  number = '#'
  dsname = 'Name'
  memtype = 'Member Type'
  size = 'File Size'
  mod_date = 'Last Modified'
  mod_time = 'Time'
  permissions = 'Access Permission'
;
infile dirlist;
input
  permissions :$10.
  links :3.
  user :$8.
  group :$8.
  size :15.
  _month :$3.
  day :2.
  year_time :$5.
  dsname :$254.
;
retain number 0;
dsname = scan(dsname,-1,'/');
extension = scan(dsname,2,'.');
dsname = scan(dsname,1,'.');
if permissions ne 'total'; /* removes header */
if extension in ('sas7bdat','sas7bvew','sas7bcat');
length memtype $10;
select (extension);
  when ('sas7bdat') memtype = 'DATA';
  when ('sas7bvew') memtype = 'VIEW';
  when ('sas7bcat') memtype = 'CATALOG';
  otherwise;
end;
month = month(input('01' !! _month !! '1960',date9.));
if length(year_time) = 5
then do;
  if month > month(today())
  then year = year(today()) - 1;
  else year = year(today());
  mod_time = input(year_time,time5.);
end;
else do;
  year = input(year_time,4.);
  mod_time = 0;
end;
mod_date = mdy(month,day,year);
format
  mod_date yymmddd10.
  mod_time time5.
;
number + 1;
keep number dsname memtype size mod_date mod_time permissions;
run;

proc print data=attributes noobs label;
var number dsname memtype size mod_date mod_time permissions;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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