How to save SAS log in text as record?

Reply
Super Contributor
Posts: 274

How to save SAS log in text as record?

Good morning, all:

 

I would like to save the SAS log in text file as record for furture review, how could I do it? Should I put the command statement at the begining of all the SAS code or at the end?  Please help, thanks.

 

For example, I would like to save the SAS log into "C:\Documment\SAS file\SAS log.txt"

Esteemed Advisor
Posts: 5,198

Re: How to save SAS log in text as record?

How do you use SAS?

If you run SAS in batch mode, a log is created by default.

 

Take a look at the LOG option, and PROC PRINTTO.

Data never sleeps
Esteemed Advisor
Esteemed Advisor
Posts: 7,232

Re: How to save SAS log in text as record?

Hi,

 

At the point you want to send the log to a file run:

proc printto log= "C:\Documment\SAS file\SAS log.txt";
run;

And when you want to end outputting to file:

proc printto;
run;
Respected Advisor
Posts: 4,992

Re: How to save SAS log in text as record?

Note that PROC PRINTTO will move your log to the file you select.  You might want something slightly different ... keeping the log where it is, but sending a copy of it to a file that you choose.  You can do that with a different tool.

 

ALTLOG must be specified at SAS invocation, not in the middle of a program:

 

http://support.sas.com/documentation/cdl/en/hostwin/67962/HTML/default/viewer.htm#n02cl0iq0k1fmxn11p...

 

It will send a copy of the log to the destination that you choose, while leaving the original log in place.

Esteemed Advisor
Posts: 6,685

Re: How to save SAS log in text as record?

Do you need the log for auditing reasons?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 346 views
  • 3 likes
  • 5 in conversation