BookmarkSubscribeRSS Feed
PReintsch
Calcite | Level 5
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!
5 REPLIES 5
SASKiwi
PROC Star

The FDELETE function will do what you want: FDELETE 

Kurt_Bremser
Super User

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.

PReintsch
Calcite | Level 5

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.

 

Kurt_Bremser
Super User

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 

Reeza
Super User

FDELETE to delete files and an empty folder. 

https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=p0h945u5r0cv6yn1u6qs35hiqt9t.htm...

 

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. 

https://communities.sas.com/t5/SAS-Programming/delete-a-folder-directory-and-all-files-on-it/td-p/58...

 


@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!

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 2070 views
  • 4 likes
  • 4 in conversation