BookmarkSubscribeRSS Feed
GioiAce
Fluorite | Level 6

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?

GioiAce_0-1755510806081.png

 

13 REPLIES 13
andreas_lds
Jade | Level 19

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?

GioiAce
Fluorite | Level 6

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
Fluorite | Level 6
thanks sir
Patrick
Opal | Level 21

@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. 

GioiAce
Fluorite | Level 6
I have around 200 jobs in my jobflows. When executing the entire jobflow, I want the successfully completed jobs to be skipped and only the previously failed jobs to be re-executed. To achieve this, I plan to record the execution status and error logs of each job in a table, so that I can selectively rerun failed jobs.
Patrick
Opal | Level 21

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?

LinusH
Tourmaline | Level 20

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.

Data never sleeps
GioiAce
Fluorite | Level 6

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.

LinusH
Tourmaline | Level 20
Sounds like standard behviour for scheduling software, so it does not make sense to build it yourself.
Logs are usually stored after running flows, and the log tells you where and why the job failed. Not sure why you want to store this in a database.
Data never sleeps
GioiAce
Fluorite | Level 6

“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. 

LinusH
Tourmaline | Level 20

"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?

Data never sleeps
Quentin
Super User

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 13 replies
  • 650 views
  • 8 likes
  • 6 in conversation