BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Newlifewithegg
Calcite | Level 5

I use sas studio and mistakenly created a weird directory by a wrong sas statement as

 

options dlcreatedir

libname  myname "output;

 

and the directory created is

 

output;OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;ODS HTML CLOSE;GOPTIONS NOACCESSIBLE;; ;*';*

 

my question is, how to possibly delete this directory from within SAS?

1 ACCEPTED SOLUTION

Accepted Solutions
Quentin
PROC Star

You can try the FDELETE() function:

filename testdir 'physical-filename';
data _null_;
   rc=fdelete('testdir');
   put rc=;
   msg=sysmsg();
   put msg=;
run;

Example is from the documentation:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0h945u5r0cv6yn1u6qs35hiqt9t.h...

 

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.

View solution in original post

7 REPLIES 7
Newlifewithegg
Calcite | Level 5
please ignore the syntax error coming with a missing ; following dlcreatedir
Reeza
Super User
Do you have the log? It should have the path the folder is created/assigned.

If so, navigate to that location using Servers Files Folders Pane and delete the folder created.
Newlifewithegg
Calcite | Level 5

Thanks, I definitely am able to remove it with system operations outside of SAS. But the purpose here is to practice with SAS, thus am asking whether there is way to deal with this case within SAS.

Quentin
PROC Star

You can try the FDELETE() function:

filename testdir 'physical-filename';
data _null_;
   rc=fdelete('testdir');
   put rc=;
   msg=sysmsg();
   put msg=;
run;

Example is from the documentation:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0h945u5r0cv6yn1u6qs35hiqt9t.h...

 

Check out the Boston Area SAS Users Group (BASUG) video archives: https://www.basug.org/videos.
Reeza
Super User

You mean using code rather than the GUI I assume?

 

In that case, FDELETE is the simplest way as shown by @Quentin 

Kurt_Bremser
Super User

Make sure no datasets exist in the library, then de-assign the libname first:

proc datasets lib=output kill;
quit;
libname myname clear;

Then run:

data _null_;
rc= fdelete("output;OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;ODS HTML CLOSE;GOPTIONS NOACCESSIBLE;; ;*';*");
run;

 

Newlifewithegg
Calcite | Level 5

Thank you all for your help. Seems the issue is more fundamental and nearly irrelevant to sas programming. The weird filename cannot be be copy/pasted to sas studio environment, it can only be pasted into word/textbox etc environments.

 

Another more complete solution can be found at

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

if the directory contains files

 

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
  • 7 replies
  • 249 views
  • 0 likes
  • 4 in conversation