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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.