DATA Step, Macro, Functions and more

Deleting the PDF File from directory

Reply
Contributor
Posts: 35

Deleting the PDF File from directory

I have written a PDF by using below statement 

 

ODS PDF FILE="C:\download\output.pdf';

proc  print data=rCCH;

run;

ODS _all_ close;

 

Once I have written the print output to PDF .Now I want to delete the PDF 

 

How Can I delete the PDF from the directory 

 

 

Super User
Posts: 6,936

Re: Deleting the PDF File from directory

[ Edited ]

Use the fdelete() function:

data _null_;
fname = "tempfile";
rc = filename(fname,"C:\download\output.pdf");
if rc = 0 and fexist(fname)
then rc = fdelete(fname);
rc = filename(fname);
run;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 1 reply
  • 114 views
  • 0 likes
  • 2 in conversation