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

I am running a program that  generates a big log while running, so I decided to use the 'PROC PRINTTO LOG.' However, at the end of the run, 

                                    I want to delete this file after checking for errors before rerunning. Unfortunately, everything is going fine, but I cannot delete the log file while the program opens in sas9.4. Is there an option I can delete even if the program is available? (it looks like I need an option like 'Libname xx clear;)

 

This is the pop message (like any other files open at some place while deleting it)

" the action cannot be completed because the file is open in sas 9.4"

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You need to close the file after you have created it. You do this via the SAS command

 

proc printto; run;

 

before you try to delete it.

 

Alternatively, don't delete it but tell PROC PRINTTO to just start a new file the next time you run the program.

 

proc printto new log= ... ;

 

 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

You need to close the file after you have created it. You do this via the SAS command

 

proc printto; run;

 

before you try to delete it.

 

Alternatively, don't delete it but tell PROC PRINTTO to just start a new file the next time you run the program.

 

proc printto new log= ... ;

 

 

--
Paige Miller
SASuserlot
Barite | Level 11

It worked Thank you very much for your help.

Ksharp
Super User
Or try this one :

dm 'log; file "c:\temp\ReportPrint.log" replace;' ;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 789 views
  • 1 like
  • 3 in conversation