07-20-2012 10:40 AM
I want to track error information after a whole SAS program has been finished,I know &syserr will set to 1 immediate after an error happen.
BUT &syserr will be override back to 0 when a NO-ERROR step was executed.
so finallly &syserr's value react for the last step. if the last step has error then &syserr will be set to 1,, otherwise will be 0.
MY question is: how we can know whether there was ANY error happened durng the whole program?------Any macro similar as &syserr but doesn't set back to 0?
PLEASE NOTICEsuppose we CAN'T set a new macro variable after EACH process of the program.such as: %if &syserror=1 then %let flag='error happened" ,
this need too much extra work if there were too much process in the program,,,maybe there were 1000 datasteps and 500 procedures in the program...)
%put -----0 &syserr;
data a1;/*error happen here,*/
%put -----1 &syserr;
%put -----n &syserr;
%put -----100 &syserr;/*but here &syserror set back from 1 to 0,,,I want a value show us there was ever error happened during the whole program*/
07-20-2012 10:50 AM
How about just reading the log and searching for the text string 'error:'? The Unix command "grep" has nice features for showing the error in context (and is also available for the PC).
I use it to search for warnings too, as they can actually be insidious errors.
07-20-2012 11:15 PM
Google "findstr", here is one hit: Findstr - Search for strings
You could also use Powershell but that would be slightly more complicated. I do like Powershell's support of context, where you can print x number of lines before or after the text match.
Google "powershell select-string", here is one hit: Select-String and Grep - Windows PowerShell Blog - Site Home - MSDN Blogs
07-20-2012 10:50 AM
I think you want this one.
Contains the current condition code that SAS returns to your operating environment (the operating environment condition code).
|Type:||Automatic macro variable (read and write)|
07-20-2012 04:38 PM
This really is a read and write automacro.I am trying to find a macro like this for a while
SYSCC is a read/write automatic macro variable that enables you to reset the job condition code and to recover from conditions that prevent subsequent steps from running. The values for SYSCC are: