SYSPRINTTOLOG option contains the current redirect of the log as can be set using the following code:
proc printto log="/some/new/loc.log"; run; %put new location = &SYSPRINTTOLOG; proc printto log=log; run; data _null_; infile "/some/new/loc.log"; input; putlog _infile_; run; %put value is now blank: &SYSPRINTTOLOG;
Note that the variable value is null when the log is not being redirected.
This feature only became available on all platforms since 9.4 M3 (source).
See documentation for more info: https://documentation.sas.com/?docsetId=mcrolref&docsetTarget=n0vz7cko681wx9n1bgkyqtepocjl.htm&docsetVersion=9.4&locale=en