Desktop productivity for business analysts and programmers

%include

Reply
Occasional Contributor
Posts: 12

%include

[ Edited ]

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;

Super Contributor
Posts: 308

Re: %include

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.

Super User
Super User
Posts: 7,725

Re: %include

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).

Occasional Contributor
Posts: 12

Re: %include

[ Edited ]

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.

 

Super User
Super User
Posts: 7,725

Re: %include

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

Trusted Advisor
Posts: 1,116

Re: %include

Hello @awojtaszek,

 

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.

Occasional Contributor
Posts: 12

Re: %include

This was an example for error

Ask a Question
Discussion stats
  • 6 replies
  • 522 views
  • 0 likes
  • 4 in conversation