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;
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.
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).
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.
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...
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.
This was an example for error
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.