BookmarkSubscribeRSS Feed
aola
Fluorite | Level 6

Hello,
I have the part of  log:

23 proc append BASE=a.ID;
sasxdbi: dbicon: special image for SAS/Poland
23 ! DATA=LOAD. FORCE;
____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
24
25 %include "/usr/local/generic.sas";

NOTE: Statements not processed because of errors noted above.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements. This might cause NOTE: No observations in data set.
NOTE: PROCEDURE APPEND used (Total process time):
real time 1.20 seconds
cpu time 0.07 seconds


How can I ignore errors to execute rest of the code? Especially %include function where I have the code:

filename myfile email
to=&e_mail.
subject= "Error"
type="text/plain";

%macro errmail;
%if &syserr ne 0 %then %do;
data _null_;
file myfile;
put;
put 'ERROR';
put "&syserrortext";
put;
put "Log: \\logs" ;
run;
%end;
%mend errmail;


%errmail

and if the error is before the %include function I don't get an e-mail then.
I want to get the information about the error no matter where is, so sas supposed to ignore errors and goes ahead and finally send me an e-mail if something went wrong.


Is it a good way?
options obs=max replace nosyntaxcheck;

6 REPLIES 6
Loko
Barite | Level 11

Hello,

 

You may use options=errorabend in order for sas to stop when it encounters an error. Afterwards you may run another program which scan the log and sends an email if it has an error.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Why on earth would you want to ignore warnings or errors?  They are there telling you that there is problems in your code which if not fixed could produce unwanted or no results.  They are the best indication that you need to fix your code.  Any validation/qc I can think of would fail code automatically at the first error or warning (notes would as well possibly).

aola
Fluorite | Level 6

It ignores in that sense I don't want to stop SAS, because

 

NOTE: Statements not processed because of errors noted above.

%include generic_query.sas

 

All errors are important to me, but I need to SAS executed the %include function because I check in a separatly file .sas if someting went wrong and send the e-mail about that.

I need to have the separately file because in another files I assign macros for that generic query.sas and if something went wrong before the %include

NOTE: Statements not processed because of errors noted above.

and I don't have an e-mail with the information about that, because this part is in %include.

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sounds to me like the whole process is a bit shaky.  I would look at the whole process from the documentation level.  Block each part out, maybe create a process flow, show where checking need to be done - checking should occur in any process and be done before errors occur, not after.  So something like: do step - are all things created, ok then move onto step 2...

FreelanceReinh
Jade | Level 19

Hello @aola,

 

Your log excerpt suggests that there is no RUN statement between the erroneous PROC APPEND code and the %INCLUDE statement. I think, the %INCLUDE would work if you completed the PROC step with a RUN statement.

aola
Fluorite | Level 6

This was an example for error

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 6 replies
  • 2760 views
  • 0 likes
  • 4 in conversation