Hi I am trying to to get the entire log of my sas program to go to the specified directory . I coded the below: However some of the log is still being written to the current directory. How do i prevent this?
%let fileTimeStamp = %sysfunc(date(), yymmddn8.);
filename valldrpt "/workspace/sas/chd_proc_auto/log/loadrpt_&fileTimeStamp";
filename chdldlog "/workspace/sas/chd_proc_auto/log/chdlog_&fileTimeStamp";
proc printto log=chdldlog new;
run;
Anything after the proc printto should be printed in the file specified.
yes, however the portion where I define the log location come out in the current directory not the specified log directory
1 %let fileTimeStamp = %sysfunc(date(), yymmddn8.);
2 filename valldrpt "/workspace/chd_proc_auto/log/loadrpt_&fileTimeStamp";
3
4 filename chdldlog "/workspace/chd_proc_auto/log/chdlog_&fileTimeStamp";
5
6 proc printto log=chdldlog new;
7 run;
> the portion where I define the log location come out in the current directory
Yes because the log is not redirected yet.
Either redirect the log for the whole session (see @yabwon 's tip) or start the session with options NONOTES NOSOURCE and set these after the proc printto.
I put the OPTIONS NONOTES NOSOURCE; but I still get a .log file in the current directory . Should I put it at the top of my script as below? That is what I did
1 OPTIONS NONOTES NOSOURCE;
2 %let fileTimeStamp = %sysfunc(date(), yymmddn8.);
3
4 filename valldrpt "/workspace/sas/chd_proc_auto/log/loadrpt_&fileTimeStamp";
5 filename chdldlog "/workspace/sas/chd_proc_auto/log/chdlog_&fileTimeStamp";
6 proc printto log=chdldlog new;
7 run;
8
> I put the OPTIONS NONOTES NOSOURCE; but I still get a .log file in the current directory
Yes, you'll get that one line in the unredirected log.
You need to set the options in a location that does not output to the log: the config file.
Two notes:
- The log file will get overwritten with each run, so it's really a small impact to have a small file in a folder.
- If you really want all the log redirected at start-up, you should use start-up options: LOG or ALTLOG. See here.
If this is something you run in batch, use the
-log
option on the commandline.
Hi,
Maybe the ALTLOG option is an option here?
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p10cborm89irzdn1m5y3o4hfw1g6.htm
Bart
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.