10-22-2017 10:02 AM
You can change your code to get what you want:
%let log_path =c:\em; proc printto log="&log_path.\log1.log"; run;
Pay attention - use double quotes instead single quotes.
10-22-2017 10:44 AM
Some other code set the path or leave it the default value. I am looking
for a way to get it without knowing what happened there
As much as I know, there is no deault path for log.
You use FILENAME staetment to link symbolic name - the fileref - to a path,
or define the path directly in your step - as you have done with PROC PRINTTO in your post.
The PROC PRINTO LOG= defines where to save next sas code lines, until it reaches the:
PROC PRINTTO; RUN; - that closes the saved log file.
If there is a predefined path, it should be in a mcro variabe.
Online session log (window) is held in SAS utility catalog.
I'm not sure you have approach to it.
10-22-2017 10:51 AM - edited 10-22-2017 10:52 AM
Just to be more clear, assuming the program is:
<code part 1> proc printto log=<path and name.log>; run; <code part 2> proc pritto; run; <code part 3>
the saved log will hold only part 2.
10-23-2017 02:24 AM
10-23-2017 03:33 AM
Check the macro-variable SYSPRINTTOLOG and the option LOG, depending on how the sas-session was started one of them is non-missing if the log is already written to a file.
10-23-2017 04:32 AM
Use %symexist() first to check if a variable exists; if it exists, inspect its contents.
10-23-2017 05:09 AM
But If It doesn't exist It brings me back to the problem of how to get log path
SYSPRINTTOLOG doesn't exist in neither of the stages of the following code
%put %symexist(SYSPRINTTOLOG); filename logfile "Y:\log1.txt"; proc printto log= logfile new ; run; %put %symexist(SYSPRINTTOLOG); proc printto;run; %put %symexist(SYSPRINTTOLOG);
10-23-2017 06:41 AM
You are right. I tested it in 9.4, both with a workspace server and display manager SAS, and in both cases SYSPRINTTOLOG is never set, although the log is successfully redirected.
This runs contrary to what is written in https://support.sas.com/resources/papers/proceedings15/SAS1575-2015.pdf, and in the relevant parts of the SAS documentation:
10-23-2017 07:28 AM
Strange. New session started with eg 7.12 on sas 9.4m3. Same result with display manager on the workspace server.
NOTE: PROZEDUR PRINTTO used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 25 26 %put &=SYSVLONG; SYSVLONG=9.04.01M3P062415 27 %put &=SYSPRINTTOLOG; SYSPRINTTOLOG="############\extlog.log" 28 29 proc printto;run;
10-23-2017 07:55 AM
I tried this but I get zero in all LOG macro variables:
filename logfile "C:\log1.txt"; proc printto log= logfile new ; run; %LET LOG1 = %SYSFUNC(getoption(LOG)); proc printto;run; %LET LOG2 = %SYSFUNC(getoption(LOG)); %put &LOG0; %put &LOG1; %put &LOG2;
10-23-2017 07:48 AM
my version is older then yours
So I guess it works only in the newer versions
( And we have in my company older versions of sas)
Any other Ideas of getting log path without using