11-02-2015 01:33 PM
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)
11-03-2015 08:25 PM
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:
11-03-2015 08:57 PM - edited 11-03-2015 09:01 PM
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