Hello everyone,
I encountered an error and would like to save it into a table in my database. Could you please help me with this?
I don't understand the purpose of saving error messages in a database, but maybe i am missing something.
Can you explain what your want to do in more detail?
Hi andreas_lds,
I am building a flow that contains multiple jobs. I would like to store the log of each job so that, if I need to rerun the flow, I can skip the jobs that already succeeded and only rerun the ones that failed. The log should also capture where the job failed and what the error was.
@GioiAce As others already pointed out a lot of this error handling could/should be done via a scheduler/scheduling software inclusive restart points.
May-be explain a bit more in detail what you've got and how you intend to build your process.
How do you run this job flow? Is this just a master program with %include statements or programs connected in SAS EG or something else?
The requirement is a bit vague.
Do you want this for all users/applications in your environment?
What is the use case to capture syntax errors?
Usually if a SAS job/session ends in error, your environment keeps track on that (e.g. SAS Job scheduling).
There are probably several ways of doing it, but a basic one would be to make sure the environment saves all the logs, and then have a (SAS? ) scripts that parses it.
Hi LinusH,
I am building a flow that contains multiple jobs. I would like to store the log of each job so that, if I need to rerun the flow, I can skip the jobs that already succeeded and only rerun the ones that failed. The log should also capture where the job failed and what the error was.
“Is it possible to retrieve that error? In Base SAS, I used PROC PRINTTO to save the log to a text file when the job runs successfully. However, if the job fails, the log is not saved.
"I am building a flow that contains multiple jobs.".
If you run the job flow in SAS Job Scheduler (or any other scheduler that you decide to integrate), I'm pretty sure the logs are saved, even if the job fails. Have you verified this?
PROC PRINTTO will write the the log file, as long as the PROC PRINTTO itself executes.
Is it possible there was an error in your code before the PROC PRINTTO step? That could make SAS enter syntaxcheck mode and may not execute the PROC PRINTTO step. It might be easier to start by avoiding PROC PRINTTO, and focus on the log files created automatically. Most schedulers will basically batch submit the SAS jobs, and there will be a logfile written somewhere that the administrators have set up. If you don't know where your log files are being written, you may want to ask your admins or other colleagues.
Also note, depending on how you have set the logic in your flow, if Job #1 errors, Job #2 may never start. The scheduler should allow you to determine whether execution of Job #2 is dependent on successful execution of Job #1 or not.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.