Help using Base SAS procedures

Deleting log/print files

Occasional Contributor
Posts: 6

Deleting log/print files

I have a SAS programme which I have to submit to a remote site to execute. In order to preserve my log/print output, I use O/S commands to delete and create them (see below for code). This has worked fine for several months and continues to work on my test machine. But, for the past two weeks, the remote site has been unable to delete the log/print files after my programme has completed. They get an error saying that the file is still in use. They are storing the files on a network server, not a local machine.

Any advice/suggestions would be appreciated.


options noxwait;

data _null_;
command = "rmdir /S /q &location_results";
call system (command);
command1 = "mkdir &location_results";
call system (command1);

proc printto;

filename outlog CLEAR;
filename outlog "&location_results\log_cohort1_mf.txt";

filename outprint CLEAR;
filename outprint "&location_results\print_cohort1_mf.txt";

proc printto new log=outlog print=outprint;
Respected Advisor
Posts: 3,890

Re: Deleting log/print files


I don't really understand how "filename outprint CLEAR;" would delete any listing output. Doesn't it just clear the output path for listing output without affecting listing output already created?

Another thought: Is there a reason for using "noxwait"? May be running things with options "xwait" and "synch" could resolve the issue. Just thinking that a change in the environment might have slowed down things so that you're now trying to delete stuff before it actually got released - just guessing here.

Occasional Contributor
Posts: 6

Re: Deleting log/print files

Yes, I agree with you. The 'filename' was included just to delete the name allocated to the output. The deletion occurred in the previous code fragment.

I will look into the 'noxwait' suggestion. Thanks.

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation