BookmarkSubscribeRSS Feed
ybz12003
Rhodochrosite | Level 12

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;

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
ybz12003
Rhodochrosite | Level 12

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Astounding
PROC Star

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.

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 connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1648 views
  • 3 likes
  • 3 in conversation