The sample driver program
create_sas_from_datasetxml_standalone.sas contains a call to the %CSTUTILCOMPAREDATASETS
macro to compare the original SAS data sets to the SAS data sets that
were created from the Dataset-XML files.
After initialization,
the program runs the %CSTUTILCOMPAREDATASETS macro.
libname sdtmdata "&studyOutputPath/data_derived";
libname sdtmdat0 "&studyRootPath/data";
%cstutilcomparedatasets(
_cstLibBase=sdtmdat0,
_cstLibComp=sdtmdata,
_cstCompareLevel=0,
_cstCompOptions=%str(criterion=0.00000000000001),
_cstCompDetail=Y
);
For example,
code=40 (8+32)
indicates
that a format and a label are different. The following message is
written to the SAS log file:
WARNING: [CSTLOGMESSAGE.CSTUTILCOMPAREDATASETS] Comparing srcdata.adqs and
trgdata.adqs - Differences: FORMAT/LABEL (SysInfo=40)
When converting SAS
data sets to Dataset-XML files and then converting them back to SAS
data sets, here are differences to expect:
-
The lengths of date- and time-related
columns are not defined in the Define-XML metadata.
Specify a length to
assign in the macro (for example, _cstdatetimeLength=64).
The length is used to create date- and time-related columns but can
be different from the original lengths.
-
SAS numeric variables are created
with a length of 8 to avoid loss of precision, even when the original
length or the length specified in the define.xml file is less than
8.
-
The length of a character variable
(DataType="text") that is not specified in the define.xml
file is created with a length of 200.
-
Small differences in precision
can be expected around the machine precision for numeric variables
that represent real numbers.
-
Character data that contains leading
spaces or trailing spaces loses the leading spaces and trailing spaces.
By specifying PROC COMPARE
options with the _cstCompOptions parameter, you can specify that the
comparison be less precise (for example, _cstCompOptions=%str(criterion=0.00000000000001)).
Less precision prevents differences close to machine precision from
being reported as errors.