Gracefully terminate a SAS program

%macro sasterm(msg);
   ods html close;
   ods preferences;
   ods html;
   data halt;
         message = &msg;
   run;
   proc print data=halt noobs;
         title;
   run;
%abort cancel;
%mend sasterm;

%sasterm('Put your message here');


/* Example of using sasterm based on a condition in a SAS DATA step
data _null_;
      set enrcd;
      by idnum2;
      if not first.idnum2 and not last.idnum2 then call symput('halt','1');
      else                                                                call symput('halt','0');
run;

%macro haltcheck;
%if &halt = 1 %then %sasterm('TRIPLE (OR MORE) DUPLICATE - TERMINATING SAS');
%mend haltcheck;

%haltcheck;
*/