BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

Did you try using \ in the filename to escape the special characters?

Something like this:

data _null_;
   length filename $500;
   filename = "/path/to/where/file/is/" || "_Error_Report;GOPTIONS NOACCESSIBLE;;*';*";
   filename = tranwrd(filename,'*','\*');
   filename = tranwrd(filename,';','\;');
   filename = tranwrd(filename,"'","\'");
   rc=filename('myfile',filename);
   if rc then put 'Unable to make fileref. ' rc=;
   else do;
     rc=fdelete('myfile');
     if rc then put 'Unable to delete file. ' rc=;
   end;
run;

Or perhaps since it looks like it might be a folder and not a file you need to make sure there aren't any files inside of it before you can delete the folder.  Also looks like the syntax for FDELETE() when deleting a folder is different than when deleting a file. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 3557 views
  • 3 likes
  • 5 in conversation