Hi Everyone,
I need to know how to clean all files (excel, sas ,txt,...) in a sas folder ?
I did a search on this community and I only found how to clean sas files and a macro to clean file to file, but I need something to do this automatically.
Can you help me?
Thank you.
The easiest way is to use the respective command from the operating system.
Does your directory contain subdirectories? If yes, do you want to remove them also, or only files in there, recursively?
Some directory contain subdirectories yes. And I need to delete only the files in this folders. This folders are in sas server.
Do you have XCMD enabled? And which operating system is your SAS running on?
windows
Why would you paste that as an image when pasting the text would be so much easier?
Anyways, this means you do not have the xcmd enabled, which means you need to use FDELETE() to navigate through and clean the files or talk to the IT area about setting up something on the server side.
Define what you mean by "clean".
If you mean delete files then OS commands are preferred. If you want to do this from SAS you may be able to use the X command such as
X "del <path>\*.* ";
to delete ALL files in the folder for Windows to delete all files in the Path, which should start at a drive letter such as c:\folder\subfolder\*.*
If you want just specific types of files then replace the second * with the file extension such as TXT, XLSX or what ever as needed.
Unix commands I'm not as familiar with but similar should work.
In many aspects of SAS cleaning refers to code to ensure that variables have the desired characteristics and values prior to analysis.
Since you are mentioning Excel and text that seems unlikely.
I want to delete files in a folder. This folder is on sas server
With this function I can delete all files in a sas server folder?
Are datasets and excel and txt files
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.