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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2558 views
  • 0 likes
  • 3 in conversation