The `cdm_validate_schemas` macro is designed for use within the CDM loading utility. Its primary function is to compare the downloaded CDM schema version (`&CDM_Download_SchemaVer`) with the currently active CDM DDL schema version (`&CDM_DDL_SchemaVer`). In case of incompatibility, the macro signals an error by setting a return code (`rc=1`) and an error message (`CDM_ErrMsg`), then uses a `%goto` statement to direct the execution flow to an error handling section (`ERREXIT`). It also uses `%CHECK_VERBOSE` and timestamped `%put` messages for tracking.
Data Analysis
Type : INTERNAL_CREATION
This script does not directly manipulate SASHELP data or read external data via `LIBNAME` or `INFILE`/`SET`/`MERGE` statements. It relies on the comparison of macro variables (`CDM_Download_SchemaVer`, `CDM_DDL_SchemaVer`) which are assumed to be initialized upstream of the script, potentially from metadata or configuration files.
1 Code Block
MACRO
Explanation : This block defines the `%cdm_validate_schemas` macro. It begins by calling another macro `%CHECK_VERBOSE` (whose code is not included here) and displays a timestamped message indicating the start of validation. It initializes a return variable `rc` to 0. The core of the logic is an `%if` statement that compares the values of two macro variables, `&CDM_Download_SchemaVer` and `&CDM_DDL_SchemaVer`. If these versions are different, an error message is displayed with the incompatible versions, the `rc` variable is set to 1 to indicate an error, and a macro variable `CDM_ErrMsg` is populated. Execution is then redirected to the `%ERREXIT:` label via a `%goto`, which represents an exit or error handling point in the macro. The macro ends with `%mend`.
Copied!
%macro cdm_validate_schemas;
%CHECK_VERBOSE;
%put %sysfunc(datetime(),E8601DT25.) --- Validating UDM and CDM schemas;
%let rc = 0;
%if &CDM_Download_SchemaVer ne &CDM_DDL_SchemaVer %then %do;
%put %sysfunc(datetime(),E8601DT25.) --- Downloaded CDM Schema version &CDM_Download_SchemaVer is incompatible with current CDM DDL Schema Version &CDM_DDL_SchemaVer;
%let rc = 1;
%let CDM_ErrMsg = Incompatible Downloaded and DDL Schema Versions;
%goto ERREXIT;
%end;
%ERREXIT:
%mend cdm_validate_schemas;
1
%macro cdm_validate_schemas;
2
3
%CHECK_VERBOSE;
4
5
%put %sysfunc(datetime(),E8601DT25.) --- Validating UDM and CDM schemas;
6
%let rc = 0;
7
8
%IF &CDM_Download_SchemaVer ne &CDM_DDL_SchemaVer %THEN %DO;
9
%put %sysfunc(datetime(),E8601DT25.) --- Downloaded CDM Schema version &CDM_Download_SchemaVer is incompatible with current CDM DDL Schema Version &CDM_DDL_SchemaVer;
10
%let rc = 1;
11
%let CDM_ErrMsg = Incompatible Downloaded and DDL Schema Versions;
12
%goto ERREXIT;
13
%END;
14
15
16
%ERREXIT:
17
18
%mend cdm_validate_schemas;
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.
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.