Gracefully terminate a SAS program

%macro sasterm(msg);
   ods html close;
   ods preferences;
   ods html;
   data halt;
         message = &msg;
   proc print data=halt noobs;
%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');

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