BookmarkSubscribeRSS Feed
yabwon
Meteorite | Level 14

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

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



6 REPLIES 6
JosvanderVelden
SAS Super FREQ
Hi Bart, have a look at this paper to see if it gives you ideas on how to approach your challenge: http://www8.sas.com/scholars/Proceedings/2006/Applications/AP16_06.PDF
Best regards, Jos
yabwon
Meteorite | Level 14

Hi Jos,

 

Thanks for the article but it wont help.  It uses X statement.  And, as I wrote, I have NOXCMD.

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



JosvanderVelden
SAS Super FREQ
Have you seen this post? https://communities.sas.com/t5/SAS-Programming/Delete-hidden-files/td-p/229878. It seems to have code using dread as you indicate. But like the solution indicates access to hidden files from within SAS using dread does not work. And my guess is that fdelete for a directory will result in an error because windows will not allow deletion of the hidden files in the directory. However I've seen some unexpected behaviour in some windows versions. I assume something like this will not work on a unix-based system.
yabwon
Meteorite | Level 14

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

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



mkeintz
Jade | Level 19

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.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
yabwon
Meteorite | Level 14

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

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 195 views
  • 0 likes
  • 3 in conversation