BookmarkSubscribeRSS Feed
Gayle
Quartz | Level 8

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;

8 REPLIES 8
ChrisNZ
Tourmaline | Level 20

Anything after the proc printto should be printed in the file specified.

tarheel13
Rhodochrosite | Level 12
Do you have proc printto; run; at the end of your program?
Gayle
Quartz | Level 8

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;
ChrisNZ
Tourmaline | Level 20

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

Gayle
Quartz | Level 8

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
ChrisNZ
Tourmaline | Level 20

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

 

yabwon
Amethyst | Level 16

Hi,

Maybe the ALTLOG option is an option here?

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p10cborm89irzdn1m5y3o4hfw1g6.htm

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1919 views
  • 3 likes
  • 5 in conversation