BookmarkSubscribeRSS Feed
mattmm
Fluorite | Level 6

Hello,

I have searched and have been unable to find a solution. This feels like it should be very simple but I am unable to resolve.

Problem: I have many scheduled programs that output logs via a proc print with their respective date & time stamps to use for general debugging. I run programming to read in the logs and look for keywords. I would like make a change to output TWO logs. One as I have been but an alternate log, without the date & time stamp, to a different directory. Please let me know how obvious this solution is...thank you. 

 

Sample Code:

%let date_time = %sysfunc(compress(%sysfunc(putn(%sysfunc(datepart(%sysfunc(int(%sysfunc(datetime()))))),yymmdd10.)),'-')) %sysfunc(compress(%sysfunc(translate(%sysfunc(putn(%sysfunc(timepart(%sysfunc(int(%sysfunc(datetime()))))),time8.)),'0','')),':'));

proc printto log='g:dir\logs\test1.log&date_time..log' new ;
/*need a output to another directory, without the datetime stamp*/
run;

data temp;
infile DATALINES dsd missover;
input a b c d;
CARDS;
1, 2, 3, 4
, 3, , 5
, 3
;
run;

Log:

mattmm_0-1595960828060.png

 

2 REPLIES 2
ballardw
Super User

This may not help, but there is a SAS system option called ALTLOG.

It is not conditional and must be set at invocation, i.e. the configuration file or the command line.

This would capture an entire session's log as well.

 

Is this second file supposed to hold different information that the "timestamped" file? If not you may be able to copy that file with X command or %SYSEXEC

 

If you are running Display Manager you might be able to get display manager commands in the body of a program to 1)make the log the active window 2) use the File or Save command to save the current contents of the Log, and return to execution (this possibly being a problem) save the log

PaigeMiller
Diamond | Level 26

I'm not aware of a way to have SAS write the log to two different destinations at once.

 

However, once you are done writing the log via PROC PRINTTO, you could then close PROC PRINTTO and use operating system commands from within your SAS program, or the FCOPY function, to copy the log to some other folder.

--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 861 views
  • 0 likes
  • 3 in conversation