Is there a way to make SAS stop upon the first warning or error?

后端 未结 5 1651
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 01:44

SAS likes to continue processing well after warnings and errors, so I often need to scroll back through pages in the log to find an issue. Is there a better way? I\'d like

5条回答
  •  -上瘾入骨i
    2020-12-03 01:58

    One option is to replace run with run &g_cancel throughout, and proc sql; with proc sql &g_noexec;. Initially &g_cancel and &g_noexec are set to nothing so everything runs.

    On hitting an error (either %sys_rc, %sql_rc or using referring to business logic) set &g_cancel to cancel and &g_noexec to noexec.

    This should stop any subsequent steps from running - obviously the macro variables can be omitted for steps that have to run regardless (for instance a tidy up) or checked before performing steps purely in macro.

    Note for Enterprise Guide users: The only warning note is that if you are running multiple code items in the same session you will need to reset the error terms at the start of each code item, lest unrelated errors stop anything working.

提交回复
热议问题