Desktop productivity for business analysts and programmers

How can I change the value of SYSERR macro variable.....

Reply
N/A
Posts: 0

How can I change the value of SYSERR macro variable.....

In my SAS program i am executing two another SAS program using %include statemnt like

%include "d:\abc.sas";
%put &syserr;
%include "d:\xyz.sas";
%put &syserr;

in the abo code if ABC.SAS is having any error then first %put statement print non zero valu i'e' error ....

i know very well XYZ .sas is not having any error but still syserr after and in between the code of XYZ , prints non zero value of SYSERR .....


suppose in my program i include 10 other SAS program and after each one i process the syserr to know that recently executed SAS JOB(program) is successfully or not.

by the wa job no 5 out of 10 is having error then for rest all of the job SYSERR will be having non zero i.e. error

what i want ....before start execution of each job ..syserr should be modified ..not having previous value.....

please help
Respected Advisor
Posts: 3,837

Re: How can I change the value of SYSERR macro variable.....

Using %include means that you have to look at your program as if it would be one big bunch of code. It's the same like having all the code in one single file.
It will therefore depend on the error in the included code whether SAS can recover from it or not (i.e. a unbalanced quotation mark would be "desasterous").
%syserr is an automatic read-only macro variable.

The following gives you some more information about error handling:
http://support.sas.com/onlinedoc/913/getDoc/en/lrcon.hlp/a000993436.htm

If you want your jobs to run independently together with some error handling you might want to look at commands like 'x', 'system' or 'systask' - or consider to use a scheduler.

HTH
Patrick
Contributor
Posts: 27

Re: How can I change the value of SYSERR macro variable.....

In my experience, &syserr is not reliable and should only be used after thorough testing of all scenarios. There have been extensive debates on SAS-L if you want to see some history.
If you are still seeking to control a process flow of SAS programs then the only reliable, home-grown solution uses scripting. For Windows, your choices are .bat files, WSH scripts or the hugely powerful PowerShell.
However, all of these options have drawbacks and there is good reason that schedulers are expensive - it is very difficult to get right.
Ask a Question
Discussion stats
  • 2 replies
  • 926 views
  • 0 likes
  • 3 in conversation