The data (loggername and message) are provided as macro parameters and do not come from external sources or SAS tables. There is no traditional data creation or reading.
1 Code Block
MACRO
Explanation : This code block defines a SAS macro named `_issueErrorMessage` that takes two arguments: `loggername` (the logger's name) and `message` (the error message). The macro starts by validating if these two parameters are provided. If either parameter is empty, a warning is issued, and the macro terminates. If the parameters are valid, it calls the `%sysfunc(log4sas_logevent(...))` function to send the error message to the specified logger. Finally, it checks the return code of this function and displays an error message if the logging operation was unsuccessful.
Copied!
%macro _issueErrorMessage(loggername, message);
%if (%length(&loggername.)=0) %then %do;
%put WARNING: loggername is null;
%return;
%end;
%if (%length(&message.)=0) %then %do;
%put WARNING: message is null;
%return;
%end;
%let _rc = %sysfunc(log4sas_logevent(&loggername., Error, &message.));
%if (&_rc ne 0) %then %do;
%put ERROR: _rc is NOT null: &_rc.;
%end;
%mend _issueErrorMessage;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de This file is part of SASUnit, the Unit testing framework for SAS(R) programs. For copyright information and terms of usage under the GNU Lesser General Public License see included file README.md or https://github.com/HMS-Analytical-Software/SASUnit/wiki/readme/.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.