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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 1284 views
  • 3 likes
  • 3 in conversation