The FDELETE function will do what you want: FDELETE
This is best done by using the appropriate operating system command with the necessary options. Since you seem to have Windows underneath your SAS, use "del".
Try this:
filename oscmd pipe "del '&CARPETA.\&SERIE.' /f 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
The single quotes might be necessary if blanks appear in the path.
Thanks for the detailed answer Kurt. However I got 3 Error messages, from which these two are very particular:
ERROR: Insufficient authorization to access PIPE.
ERROR: No logical assign for filename OSCMD.
This means that, sadly, your SAS administrator has not enabled the XCMD system option. Either you get him/her to enable that, or you use the macro linked to by @Reeza
FDELETE to delete files and an empty folder.
Macro to recursively delete files using FDELETE
https://www.sascommunity.org/mwiki/index.php?title=Recursively_Delete_Files
Or use XCMD and a command line statement.
@PReintsch wrote:
Hello guys! I am new utilising SAS Enterprise Guide and I have been frustrating over this,
My Libraries and OUTPUT folders have been created this way:
options dlcreatedir;
libname OUTPUT "&CARPETA.\&SERIE.";
where, &CARPETA is a path and &SERIE is the name of the FOLDER.
After all the regressions are done, the FOLDER called 'SERIE' contains:
- SAS tables; aaa.sas
- Excel file; bbb.xlsx
I want to DELETE the FOLDER 'SERIE' completely.
I have tried deleting what is inside first, but I just managed to delete the SAS tables only. Is there a way to delete the FOLDER itself at once? In case it is not posible, how can I delete the excel file? Please!!!
Greetings!
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!
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.