BookmarkSubscribeRSS Feed
woo
Barite | Level 11 woo
Barite | Level 11

Is there any way (code or process) to figure out what access we have for any visible table from any librabry in EG 5.1? (especially when you are not admin and have limited access on environment) 

2 REPLIES 2
hbi
Quartz | Level 8 hbi
Quartz | Level 8

If you only want to know what libraries and datasets you have access to (that are defined in SAS metadata), you could do something like this: 

 

PROC SQL;
  CREATE TABLE work.list_of_accessible_ds AS 
  SELECT DISTINCT LIBNAME, MEMNAME
  FROM DICTIONARY.TABLES
  WHERE LIBNAME <> 'WORK'
  ORDER BY 1, 2;
QUIT;

 

Note that the above query will only show libraries and datasets that are already showing a yellow icon in the "Server List" pane:

 

  SAS-EG-server-list-pane.gif

 

 

hbi
Quartz | Level 8 hbi
Quartz | Level 8

The above will not tell you what other datasets you might have access to (since they may not be defined in SAS metadata). You will likely need to do something via the command line in Unix (e.g Putty).

 

These two lines will search recursively for all SAS datasets (*.sas7bdat) starting at the very top. I included a flag to omit "Permission denied" errors, because the output would be very difficult to read. However, the number of datasets will likely exceed the buffer in a terminal emulator like Putty using this technique ... 

 

 

# *** go to root directory ***
cd /
# *** search recursively for all SAS datasets ***
find . -name "*.sas7bdat"  2>&1 | grep -v "Permission denied" 

 

Due to the buffer limitation, you may want to output the results to a text file and then view the results in a text editor like "vi" or "pico". The output is sent to "/home/your_username/all_sas_datasets.txt". You could do something like this ... 

 

 

 


cd / 
# *** same as above but send output to a file in your home folder *** 
find . -name "*.sas7bdat" 2>&1 | grep -v "Permission denied" > ~/all_sas_datasets.txt 
# *** change directory to your home folder *** 
cd ~ 
# *** show the path to my home folder *** 
pwd 
# *** now, view the file in VI *** 
vi all_sas_datasets.txt 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1518 views
  • 0 likes
  • 2 in conversation