1

エラー処理はありますが:

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

%macro errmail;                                                                                                                         
 %if &syserr ne 0 %then %do;  
 options obs= max replace nosyntaxcheck; 
  data _null_;        
   file myfile;                                                                                                                                                                                               
   put;                                                                                                                                 
   put 'ERROR';                                                                                                                    
   put "&syserrortext";                                                                                                                 
   put 'check a log'
  run;       
 %abort cancel;  
 %end;                                                                                                                                  
%mend errmail;

proc export でエラーが発生した場合: (&number. は作業中のテーブルです)

proc export data=&number.
outfile="/usr/local/backup/&number./&number._%SYSFUNC(TODAY(),DATE9.).txt"
replace
dbms=dlm; 
delimiter=';';
 run;
 %errmail;

ERROR: Physical file does not exist, /usr/local/backup/2116/2116_13MAY2016.txt.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 1 observations read from the data set WORK.2116.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

SAS はマクロをチェックせず、電子メールも送信しません。パスにエラーがあるので、エラーは理解できますが、それについて電子メールを送信する必要があり、マクロが原因で SAS が処理を停止するようにしてほしいです。マクロにいくつかのオプションを追加すると修正できますか?

4

1 に答える 1