Hey SAS-L,
The XCMD is turned off.
Is there a way to convince SAS to, when running DREA(), DNUM() etc. functions, see hidden files too?
Something like:
x 'DIR /A';
under Windows
or
filename f PIPE 'ls -a';
under Linux or UNIX systems,
but without OS level interaction.
All the best
Bart
Hi Jos,
Thanks for the article but it wont help. It uses X statement. And, as I wrote, I have NOXCMD.
Bart
yes, I read that one too.
the FDELETE() will work with a hidden file, since it accepts a fileref and a fileref points to a particular object so this:
filename x "~/.test_hidden";
data _null_;
file x;
put "text";
run;
data _null_;
rc = fdelete('x');
run;
will work ok (I did a test on linux)
So if you have a list of hidden files you will be able to delete them, thing is to get that list with DOPEN, DREAD, DNUM, etc.
Bart
Here's a random thought:
Does/would your system administrator permit use of some single other SAS session that allows XCMD with access to the same data storage as your sas session? Can that session be configured as the server for a sas/connect client session on your end?
Restricting access to that server might be a way for sysadmins to maintain desired authorization restrictions, while you (as an authorized user) can have your sas/connect client use the server as a proxy for the needed xcmd actions.
Hi Mark,
Well, it's not that easy.
I was thinking about a general solution, in particular this macro: https://github.com/SASPAC/baseplus/blob/main/baseplus.md#dirsandfiles-macro which is OS independent solution, with no XCMD needed, but lacks that "see hidden files" feature.
I was hoping that there is some SAS option which I missed that allows for such a "in depth" view. Unfortunately it looks like there is no way to do it without an OS access.
Bart
Hi Bart,
Did you ever find a solution to this?
I'm trying to delete a folder structure cloned from GitHub, that contains .gitignore and .gitkeep files.
I'm running into the same issue.
Thanks,
Lex
Unfortunately I didn't find one 😞 😞
Unless you have XCMD enabled and will to run OS commands, SAS functions won't help you.
I also doubt that asking SAS for development will work... 😞
Bart
Voted 👍
My original use-case was being able to delete a folder structure cloned from GitHub.
I was not able to do this, because the folder structure contained hidden files like .gitkeep and .gitignore.
It turns out that the GIT_DELETE_REPO function does exactly what I was looking for.
The GIT_DELETE_REPO function deletes a specified local Git repository and all of the contents inside that repository.
And actually, the function does not seem to care whether the folder is a Git folder. It will just delete any folder structure.
data _null_;
RC = GIT_DELETE_REPO('/home/lexjansen/dataset-json-sas');
put RC=;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.