Hi,
I have been using the below query to save my sas logs. However, while I run the code, I can not view the live log. Please help.
proc printto log="C:\Reports\LK55_&sysdate..txt" New;
run;
option obs=max;
proc import datafile= "//<<path>>/LK.xlsx"
out=LK
dbms=xlsx replace;
run;
I have also used Proc printo;run; before import query, this is giving the live log but the saved logs is having NIL data in this case.Is there any way to actually get both the logs..?
You could write the file to the log afterwards, e.g.:
Filename mylog "C:\Reports\LK55_&sysdate..txt";
Proc printto log=mylog new;
run;
/* your code here */
Proc printto;run;
data _null_;
infile mylog;
input;
put _infile_;
run;
Since you are redirecting the whole log, it's not sent to EG anymore. To have a complete log written to disk, and still display in EG, you need to work with the logconfig.xml of the workspace server.
If you can't edit logconfig.xml of the workspace server, as @Kurt_Bremser suggested, you could add a step in EG to export the Log
automatically.
You could write the file to the log afterwards, e.g.:
Filename mylog "C:\Reports\LK55_&sysdate..txt";
Proc printto log=mylog new;
run;
/* your code here */
Proc printto;run;
data _null_;
infile mylog;
input;
put _infile_;
run;
Works like charm, Thanks a lot!!
If you run your programs in batch mode then no re-direction of logs is required AND you can monitor live logs as well. Using SAS Management Console and the batch program scheduler is the best option for this assuming to use a remote SAS server.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.