BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sourav_sas
Quartz | Level 8

I am glad, I have learned some new error codes. But I am not able to find out the exact error code matching with my error. I have tried with couple of like 1016, 1012, 3000, 1008. But only it is working and sending mail when I am using

NE 0

I need your little bit more support, If you can help me here with the exact error code. I am using  EG 7.13

Thanks

 

Regards

Sourav

Kurt_Bremser
Super User

Scroll down in the link I gave you, there's a further link to the SYSERRORTEXT automatic macro variable. Run your code so that it produces the error, and issue a %put &syserrortext; immediately after the step.

Sourav_sas
Quartz | Level 8

Super. With

%put &syserrortext;


This one is working. I am getting mail. But I am looking for getting mail only for the specific error

 

"ERROR 180-322: Statement is not valid or it is used out of proper order."

With "syserrortext" for any text type error I am getting mail. But I need user only gets mail when specific error will arrive.

ERROR: "ERROR 180-322: Statement is not valid or it is used out of proper order."

 

Thanks.

Regards

Sourav

 

 

Sourav_sas
Quartz | Level 8

With SYSERR and SYSERRORTEXT we can read the log error in SAS. But my point is I need to read one specific error. There I am not able to do that. For all error it is sending mail. That is not my expectation. I want to send mail respect to one single error from the LOG.

Is there any way I can do that?

 

Thanks

Regards

Sourav

Sourav_sas
Quartz | Level 8

Here I have one Sample code.

filename myfile email                                                                                                                   
to= "***.****@****.****"                                                                                                               
subject= "Error in Report"                                                                                                              
type= "text/plain"
importance="HIGH";
 

%macro errmail;                                                                                                                        
 /*%if "&syserrortext" is "Statement is not valid or it is used out of proper order." %then %do;*/
  data _null_;                                                                                                                          
   file myfile;                                                                                                                         
   put 'Your job received the following ERROR/WARNING message:';                                                                        
   put;                                                                                                                                 
   put 'ERROR was:';                                                                                                                    
   put "&syserrortext";                                                                                                                 
   put;                                                                                                                                 
   put 'WARNING was:';                                                                                                                  
   put "&syswarningtext";                                                                                                               
  run;                                                                                                                                  
/* %end;                                                                                                                                  */
%mend errmail;                                                                                                                          
                                                                                                                                        
data one;                                                                                                                               
 a;                                                                                                                                     
run;  

%put &syserr; /*or %put &syserrortext;*/ 
                                                                                                                                        
%errmail;



I am using this sample to get mail I am getting any error in the SAS Log. But I am looking for one condition there I can get mail for some specific error in Log. This is user requirement. I need to solution on urgency basis.

 

I am creating error in this code intentionally to get error.

Anyone has ant solution on this problem please let me know. I am trying for a long time.

Please give me the solution on code. It will be more easier for me.

 

Thanks

Regards

Sourav

RW9
Diamond | Level 26 RW9
Diamond | Level 26

And for the third time, previous posters have responded to you with reasoning on how you would do this in the code which is generating the issues, or by reading in the log file generated by the code which causes the issues.  Neither of these you have tried to use or in most cases responded to.  

Sourav_sas
Quartz | Level 8

I am trying all those points. But I am not getting the exact solution what I am looking for. Please see this post again and the code, I need mail on specific error text. I need to mention the error text in the code. How can I do that? Till now I did not get that resolution.

 

 

Regards

Sourav 

ChrisHemedinger
Community Manager

I've combined your three topics into one.  Since it's the same question and same people responding, it's most efficient for everyone if we can keep all of this together.  Posting new topics just increases the number of conversations to track.

 

Are you trying to trigger this e-mail from within the same SAS job that triggered the error?  I guess so, if you're relying on SYSERR macro vars.  If so, ERROR 180-322 -- a syntax error most often caused by a missing semicolon or mismatched parentheses -- can leave the SAS session in a bad state, making it difficult for a subsequent step to be a reliable mechanism to send e-mail.

 

Instead, if this is critical, you would need to save the SAS log and parse it as a separate file within a separate SAS job, and then send e-mail based on the findings.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Sourav_sas
Quartz | Level 8

Tons of thanks Kurt.

 

For this simple solution I made the thing too much complicated. I need to check with the business if it will work. Then I will come back to you again.

Thanks again for your effortless help.

 

Regards

Sourav

Sourav_sas
Quartz | Level 8

Kurt

 

Tons of thanks or effort. Here I have again one point in SUBSTR function. We have mentioned in the following code

%if "%substr(&syserrortext,1,7)" = "180-322" %then %do;

in the place of matrix &syserrortext, but my concern is, can I use the error text here,

 

Suppose I have error like

"ERROR: The SAS System stopped processing this step because of insufficient memory."

If there is no error code.

Then how can I go with that. Because in my case I have to mention the error text, there is no error code.

I need your help.

 

Regards

Sourav

Sourav_sas
Quartz | Level 8
Hi Kurt

It would be so great, if you help on the test error issue, I want to send mail respect to error test, not the error code.

Kurt_Bremser
Super User

If a SAS job crashes, just send the log, and let users figure it out. They're not babies and they don't need you to change their diapers.

If you can identify certain problems by the specific error code and the place in the program where they happen, you can make up any custom message you like.

You've gotten several examples for testing numeric codes and contents of strings already, just follow the advice.

sas-innovate-2024.png

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.

 

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
  • 28 replies
  • 4247 views
  • 4 likes
  • 5 in conversation