DATA Step, Macro, Functions and more

Rerouting log and output to another location

Reply
Contributor
Posts: 21

Rerouting log and output to another location

Hello,

 

I run my programs in batch mode and I also use macros within the program that reference the pathnames and program name. The goal is to run the programs from a particular location and send the output and log files to another location on our server. I don't want to use the proc printto method because I have to put that at the top of the program and would not be able to use the macros I create later in the program. I want to use the DM method but it is not working. I have the following piece of code at the bottom of the program.

 

dm 'log ; "pathname\programname.log" ' ;

 

I don't get an error but the file does not show up in the appropriate folder. What am I doing wrong??

 

L

Trusted Advisor
Posts: 1,831

Re: Rerouting log and output to another location

Use ALTLOG=<path and name> on the sas execution line in your script.

Trusted Advisor
Posts: 1,831

Re: Rerouting log and output to another location

As much as I remeber you can't use DM in batch mode.
Contributor
Posts: 21

Re: Rerouting log and output to another location

Thanks Shmuel,

 

That is true, DM doesn't work in Batch mode. I started googling the altlog option you proposed and I can't figure out how to get it to work. Can you give me a simple example of how I would add this to my code? Thank you.

 

Lorena

Trusted Advisor
Posts: 1,831

Re: Rerouting log and output to another location

Depending on OS

 

In windows

C:\Program Files\Sas\Sas 9.1\sas.exe -SYSIN Pgm1.sas -altlog='<path and log file name>' .... more options ....

If you have issues - post your script, running sas batch.

 

Frequent Contributor
Posts: 109

Re: Rerouting log and output to another location

[ Edited ]

For SASBASE 9.4 in Windows this is how it will work:

 

<SASBASE instaled path>\sas.exe -CONFIG <SASBASE instaled path>\nls\en\sasv9.CFG -sysin <prgram with path name> -autoexec <if any with path name> -log <log path with log name>

 

the last tag will print the logs where you want it to print. And it will print the batch log. Not Applog.

 

Hope this helps.

Ask a Question
Discussion stats
  • 5 replies
  • 111 views
  • 2 likes
  • 3 in conversation