SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to copying output in Log window to an external file?

Reply
Super Contributor
Posts: 297

How to copying output in Log window to an external file?

Hi, all:

 

I would like to copy the output from LOG window to a text file with defined location.  I wrote the code below, it didn't work.  Why?

 

SAS/altlog="C:\Documment\SAS file\SAS log.txt";

run;

Super User
Super User
Posts: 7,413

Re: How to copying output in Log window to an external file?

Add in, before the code which's output is to be redirected, this code:

proc printto log="<path to file><filename>.txt";
run;

And then to set it back to the normal log:

proc printto;
run;
Super Contributor
Posts: 297

Re: How to copying output in Log window to an external file?

The purpose is to COPY a LOG to a text file, not send all of LOG to a text file.  It's different.

Super User
Super User
Posts: 7,413

Re: How to copying output in Log window to an external file?

[ Edited ]

Then highlight the text you want in the log window, press cntl+c, open notepad and press cntrl+p.  Or right click on the log window, do Save As, point it to where you would like and save.

 

Also, could you clarify what the difference is?

"The purpose is to COPY a LOG to a text file, not send all of LOG to a text file.  It's different."

 

In the first instance the log is sent to the log window, you then copy it to a file, in the second it is sent straight to a file.  No difference at all other then the interveening step.

Super User
Posts: 5,085

Re: How to copying output in Log window to an external file?

ALTLOG does not use a slash, it uses a dash.  I think this would be the correct usage:

 

SAS prog1 -altlog C:\Documment\log.txt

 

Note that this is not a SAS program.  It is a command that runs the SAS program named prog1.sas, and saves a copy of the log in a totally different folder.

Ask a Question
Discussion stats
  • 4 replies
  • 338 views
  • 3 likes
  • 3 in conversation