Hi,
I am trying sas code with unix commands to read all directories /sub directories(in unix - IPswitch) but few folders don't have permission to read so I am getting cannot access in the log those report folders need to be captured in a dataset along with folder level owner/group information. Could you please help with that to crack?
Code used:
Hi @Universe ,
perhaps I am not understanding you, as you are requesting help with code, however it seems to me as your issue is with permissions. If the user that is owner of the SAS process does not have the right permissions, it won't be able to perform certain actions. You probably should align with our Unix admin.
This being said, I can see your code is quite elaborate for the required listing for which I commend you for.
However, since you are already using linux commands, perhaps you could use linux commands to do that job, much more simpler and with less lines of code.
Some examples:
tree -nf | awk '{printf $0} {system("stat -c \" [ %y ]\" " $NF )}'| sed -e 's#\([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\).*#\1 ]#g' 2>/dev/null
ls -Rl --time-style=long-iso /path/to/directory
tree -D
If you can't access the files from the LINUX/ UNIX/ any operating system command line why should the user be able to circumvent the system security features such as permissions to do things in SAS?!?
I think the system administrator would be very cross with all involved.
If a user needs access then talk the admin about changing permissions.
We cannot help you access files you are not allowed to access.
We could suggest better SAS code that what you showed.
If you just want to get a list of files you do not need to use operating system commands.
For example you could use this macro:
https://github.com/sasutils/macros/blob/master/dirtree.sas
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.