04-13-2016 10:16 AM
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";
04-13-2016 10:22 AM
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;
04-13-2016 10:34 AM - edited 04-13-2016 10:36 AM
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.
04-13-2016 10:39 AM
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.