%macro ckforerr(file=); /* Utility macro invoked from within SAS/Intrnet web apps. It checks for a global variable errmsg. If it is not blank, that message is displayed and the application aborts. */ %let revdate=09/05/2023 8:37:29 AM; %global errmsg _nerr _errlvl; %if %superq(errmsg) ne %str() %then %do; %if &_errlvl eq %str() %then %let _errlvl=error; %if &_errlvl = error %then %let _nerr = %eval(&_nerr + 1); options no$syntaxcheck obs=max; data _null_; file _webout; %if &_errlvl = error %then %do; put '
The application is aborting. Please correct inputs or report error to developer before trying again.
'; options obs=0; stop; run; %if %superq(file) ne %str() %then %do; data _null_; file &file mod; put "Error detected: %superq(errmsg). Application will be aborting"; stop; run; %end; %end; %else %do; put "