Special Topic: Comparing the Metadata Defined in a Define-XML File with the Metadata from the SAS Version 5 XPORT Transport Files

When you receive a Define-XML file combined with a folder of SAS Version 5 XPORT SAS transport files or a library of SAS data sets, it is important to ensure that the Define-XML file accurately defines the data in the SAS Version 5 XPORT transport files or SAS data sets.
The %CSTUTILCOMPAREMETADATASASDEFINE macro compares the metadata in the SAS Version 5 XPORT transport files or in the SAS data sets with the metadata in the Define-XML file. This macro supports both CRT-DDS 1.0 and Define-XML 2.0.
Before you can use the %CSTUTILCOMPAREMETADATASASDEFINE macro, convert the metadata in the Define-XML file into a SAS representation. For more information about this process, see Reading CDISC CRT-DDS 1.0 or Define-XML 2.0 define.xml Files: %CRTDDS_READ and %DEFINE_READ Macros.
The %CSTUTILCOMPAREMETADATASASDEFINE macro compares metadata between two different sources:
  • Metadata extracted from the SAS representation of a CRT-DDS 1.0 or Define-XML 2.0 file. This metadata must be created using either the %CRTDDS_READ or %DEFINE_READ macro to import a define.xml file.
  • Metadata extracted from a folder of XPORT files or a library of SAS data sets.
The results of the comparison are presented in a SAS data set that contains the columns shown in the following table:
SAS Data Set Columns Created by the %CSTUTILCOMPAREMETADATASASDEFINE Macro
Column Name
Column Description
StandardName
Standard Name
StandardVersion
Standard Version
MetadataLib
Metadata Library
DataLib
Data Library
XPTFolder
XPORT Folder
Table
Table
Column
Column
Issue
Issue
define_value
Define Value
data_value
SAS Value
Comment
Comment
The Issue column summarizes issues that are found. The issue is identified by a keyword.
The following table shows the Issue column keywords and their meanings:
Issue Column Keywords
Issue Column Keyword
Meaning
DSLABEL
The data set label does not match the data set description in the Define-XML metadata.
LABEL
The variable label does not match the variable description in the Define-XML metadata.
DEFINE_COLUMN
The Define-XML metadata defines a variable that is not in the data set.
DATA_COLUMN
A data set column does not have a definition in the Define-XML metadata.
LENGTH
Inconsistencies exist between the length of the SAS variable and the length defined in the Define-XML metadata.
Note: This check is performed only for SAS character variables because the definition of the length of a numerical variable is not compatible between SAS and Define-XML.
TYPE
Inconsistencies exist between the type of the SAS variable and the DataType defined in the Define-XML metadata.
Here is an example of the code to check the metadata for a CRT-DDS 1.0 file:
%cst_setStandardProperties(_cstStandard=CST-FRAMEWORK,_cstSubType=initialize);
%cstutil_setcstsroot;

%let studyRootPath=&_cstSRoot/cdisc-crtdds-1.0-&_cstVersion;
%let studyOutputPath=&_cstSRoot/cdisc-crtdds-1.0-&_cstVersion;

filename srcdata "&studyRootPath/transport";
libname srcmeta "&studyRootPath/data";
libname results "&studyOutputPath/results";

%cstutilcomparemetadatasasdefine(
  _cstSourceXPTFolder=%sysfunc(pathname(srcdata)),
  _cstSourceMetadataLibrary=srcmeta,
  _cstRptDS=results.compare_metadata_results
  );
This example is located here:
sample study library directory\cdisc-crtdds-1.0-1.7\programs\compare_metadata_sascrtdds_xpt.sas
The Results data set indicates no issues.
Results Data Set Indicates No Issues
Results Data Set Indicates No Issues
Here is an example of the code to check the metadata for a Define-XML 2.0 file:
%cst_setStandardProperties(_cstStandard=CST-FRAMEWORK,_cstSubType=initialize);
%cstutil_setcstsroot;

%let studyRootPath=&_cstSRoot/cdisc-crtdds-1.0-&_cstVersion;
%let studyOutputPath=&_cstSRoot/cdisc-crtdds-1.0-&_cstVersion;

filename srcdata "&studyRootPath/transport";
libname srcmeta "&studyRootPath/data";
libname results "&studyOutputPath/results";

%cstutilcomparemetadatasasdefine(
  _cstSourceXPTFolder=%sysfunc(pathname(srcdata)),
  _cstSourceMetadataLibrary=srcmeta,
  _cstRptDS=results.compare_metadata_results
  );
Instead of specifying a folder that contains XPORT files in the _cstSourceXPTFolder parameter, you can specify a library with SAS data sets in the _cstSourceDataLibrary parameter. This example is located here:
sample study library directorycdisc-definexml-2.0.0-1.7\programs\compare_metadata_sasdefine_xpt.sas
The Results data set indicates several issues.
Results Data Set Indicates Several Issues
Results Data Set Indicates Several Issues