Hello everyone,
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 NOTICE:(suppose 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...)
Thanks
Mike
/*sasprogram.sas*/
%put -----0 &syserr;
data a1;/*error happen here,*/
set sashelp.class2;
run;
%put -----1 &syserr;
/*
data a(n);
set sashelp.class;
run;
%put -----n &syserr;
*/
data a100;
set sashelp.class;
run;
%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*/
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.
Doc Muhlbaier
Thank you Dr.Duke,
Your suggestion is very interesting to me! would you like to share your "grep" code under PC enviroment?
Thanks!
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
HTH,
Scott
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) |
This really is a read and write automacro.I am trying to find a macro like this for a while
Thanks!
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:
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.