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 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 1061 views
  • 0 likes
  • 2 in conversation