BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
Patrick
Opal | Level 21
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
acfarrer
Quartz | Level 8
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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 3182 views
  • 0 likes
  • 3 in conversation