Each SAS
Clinical Standards Toolkit process uses a SAS driver module to set
up the program execution flow. The following steps show the execution
flow in a typical SAS driver module to perform SAS Clinical Standards
Toolkit validation. For example, in a SAS 9.2 deployment, the CDISC
SDTM 3.1.2 validation driver module can be found in:
!sasroot/../../SASClinicalStandardsToolkitSDTM312/1.3/sample/cdisc-sdtm-3.1.2/sascstdemodata/programs/validate_data.sas
Step 1: Define the study data and metadata locations.
/* There are several ways to define the study data and metadata
locations. These include (but are not limited to):
- Pre-allocation of libraries through some user-defined set-up mechanism
- Definition within a user-defined driver program such as this one
- Full explicit definition within a work sasreferences control data set
- Use of a global macro variable referenced within each sasreferences file
This driver program illustrates use of the last mechanism, setting the
global macro variables studyRootPath and studyOutputPath, which are referenced
within the sample study sasreferences data set path column.
Note this example is dependent on the SAS version and installation folder structure. */
data _null_;
select("&sysver");
when("9.1")
do;
call symput('studyRootPath','!sasroot/../SASClinicalStandardsToolkitSDTM312
/1.3/sample/cdisc-sdtm-3.1.2/sascstdemodata');
call symput('studyOutputPath','!sasroot/../SASClinicalStandardsToolkitSDTM312
/1.3/sample/cdisc-sdtm-3.1.2/sascstdemodata');
end;
otherwise do;
call symput('studyRootPath','!sasroot/../../SASClinicalStandardsToolkitSDTM312
/1.3/sample/cdisc-sdtm-3.1.2/sascstdemodata');
call symput('studyOutputPath','!sasroot/../../SASClinicalStandardsToolkitSDTM312
/1.3/sample/cdisc-sdtm-3.1.2/sascstdemodata');
end;
end;
run;
The &studyRootPath
and &studyOutputPath variables facilitate code standardization
and portability. They are not required.
%let workPath=%sysfunc(pathname(work));
The workPath
value provides the path for the Work directory. This directory is
referenced within the sample study SASReferences data set path column.
It is not required.
* Note the number of calls should match the unique
studyOutputPath subdirectories in sasreferences *;
%****cstutil_createunixsubdir(_cstSubDir=results); * <---
example UNIX override *;
The SAS
Clinical Standards Toolkit processes normally create one or more output
files. These files might reside in the Work directory or point to
some external location. The &studyRootPath variable points to
read-only locations in the !sasroot folder hierarchy. The &studyOutputPath
variable points to writable locations for process output, often in
the
!sasroot folder heirarchy.
UNIX users (or any users) might find it necessary to reset &studyOutputPath
to some write-enabled location since the !sasroot directories are
typically write protected. For these users, calls to the %cstutil_createunixsubdir
macro create any workpath subdirectories that are expected by SASReferences
records and set &studyOutputPath to workpath.
%let _cstSetupSrc=SASREFERENCES;
%let _cstStandard=CDISC-SDTM;
%let _cstStandardVersion=3.1.2;
These
convenience macro variables are used primarily for reporting purposes
later in the validation process.
Step 2: Set the SAS Clinical Standards Toolkit framework properties
and global macro variables. Create an empty work.sasreferences data
set to be populated in the validation process.
* Set properties provided as part of the CST-FRAMEWORK standard. ;
%cst_setStandardProperties(
_cstStandard=CST-FRAMEWORK,_cstSubType=initialize);
%cst_createds(_cstStandard=CST-FRAMEWORK,
_cstType=control,_cstSubType=reference,
_cstOutputDS=work.sasreferences);
Each registered
standard should have its own initialize.properties. For each standard
that is included in a specific process, the %cst_setStandardProperties
macro can be called at this point. Alternatively, type=properties
records can be added to the SASReferences data set, and properties
are processed when the %cstutil_allocatesasreferences macro is called.
This latter approach is followed in the SDTM validate_data.sas driver
module.
Step 3: Build the work.sasreferences data set.
The validate_data.sas
module initializes the SASReferences data set that is required for
SDTM validation. The SASReference data set defines the location and
name of the Validation Control data set. The Validation Control data
set contains the set of checks to be included in the validation process.
The sample validate_data.sas driver progra, sets the path of the Validation
Control data set to
&studyRootPath/control
and name to
validation_control.sas7bdat
. In SAS 9.2, this translates to
!sasroot/../../ SASClinicalStandardsToolkitSDTM312/1.3/sample/cdisc-sdtm-3.1.2/
sascstdemodata/control/validation_control.sas7bdat
. For an explanation of the purpose and content of each SASReferences
file, see
SASReferences File. For a fully initialized SASReferences data set for SDTM
validation, see
Sample SASReferences File for CDISC SDTM Validation.
Step 4: Call the %cstutil_processsetup macro.
The %cstutil_processsetup
macro completes process setup. It ensures that all SAS librefs and
filerefs are allocated; all system options, macro autocall paths and
format search paths are set; and that all global macro variables that
are required by the process have been appropriately initialized.
The %cstutil_processsetup
macro uses the following parameters.
This parameter determines
what initial source setup should be based on. Valid values are SASREFERENCES
(default) or RESULTS. If RESULTS is specified, then no other parameters
are required, and setup responsibility is passed to the cstutil_reportsetup
macro. The Results data set name must be passed to cstutil_reportsetup
as libref.memname.
This parameter specifies
the folder location of the SASReferences data set. (The default value
is the path to the Work library.)
This parameter specifies
the name of the SASReferences data set. (The default value is SASREFERENCES.)
The %cstutil_processsetup
macro call:
%cstutil_processsetup();
in
the validate_data.sas driver reflects the acceptance of the macro
parameter defaults listed above.
The %cstutil_processsetup
macro parameter values tell the process where to find the SASReferences
data set.
*********************************************************************;
* Set global macro variables for the location of the sasreferences *;
* file (overrides default properties initialized above *;
*********************************************************************;
%let _cstSASRefsName=&_cstSASReferencesName;
%let _cstSASRefsLoc=&_cstSASReferencesLocation;
The final
setup step for the %cstutil_processsetup macro is a call to the %cstutil_allocatesasreferences
utility macro. The SASReferences data set is now interpreted by the
SAS Clinical Standards Toolkit. The following actions complete the
process:
-
-
The %cstutil_checkds
macro is called to perform internal validation on the SASReferences
data set updated in the %cst_insertstandardsasrefs macro.
-
All filerefs
and librefs are allocated. (This action is contingent on the _cstReallocateSASRefs
property or global macro variable value).
-
Any property
files are passed to the %cst_setProperties macro to create global
macro variables.
-
The format
search path is set if any type=fmtsearch records are found. This is
based on the order specified.
-
The autocall
path is set if any type=autocall records are found. This is based
on the order specified.
-
A Messages
data set is created to contain records from each referenced standard.
This data set is based on the _cstMessages and _cstMessageOrder properties
or global macro variable values. This data set is used for the duration
of the process to add fully resolved messages to the Results data
set.
At this
point, all libraries should be allocated, all paths and global macros
should be set, and the global status macro variable _cst_rc should
be set to 0. The process is ready to proceed.
This is
a common process failure point because of the importance of the SASReferences
data set. The SASReferences data set is key to the process, and any
errors will cause the process to fail. For tips on debugging problems
with the SASReferences data set, see
Special Topic: Debugging a Validation Process.
Step 5: Run validation tasks.
* Run the standard-specific validation macro. ;
%sdtm_validate;
The %sdtm_validate
macro performs the following tasks:
-
The macro
looks up the Validation Control data set reference from SASReferences.
-
The macro
resorts the Validation Control data set based on the _cstCheckSortOrder
property or global macro variable value. This step is optional.
-
For each
check in the Validation Control data set, this macro calls the check
macro specified in the Validation Control
codesource field. It passes all of the check metadata to the check macro.
-
After
all of the checks are run, the following happens:
-
The results are saved to the file
specified in SASReferences (type=results, subtype=validationresults).
-
Any process results are summarized
in the Metrics data set if specified.
-
The metrics are saved to the file
specified in SASReferences (type=results, subtype=validationmetrics).
-
Various SAS Work files are cleaned
up if needed.
Step 6: Clean up the session.
* Clean up the SAS Clinical Standards Toolkit process
files, macro variables and macros.;
%*cstutil_cleanupcstsession(
cstClearCompiledMacros=0
,cstClearLibRefs=0
,cstResetSASAutos=0
,cstResetFmtSearch=0
,cstResetSASOptions=1
,cstDeleteFiles=1
,cstDeleteGlobalMacroVars=0);
Step 6
is optional, and it is unnecessary with batch processing. You should
not clean up prematurely or aggressively if additional SAS Clinical
Standards Toolkit processes are to be run in the same interactive
SAS session.
The following
table summarizes what the SAS Clinical Standards Toolkit attempts
to do when each of the %cstutil_cleanupcstsession macro parameters
is enabled:
Parameter Details for the %cstutil_cleanupcstsession Macro
|
|
|
Delete all macros from
the work.sasmacr catalog.
|
|
Reset the SASAutos path
based on the value of the macro variable cstInitSASAutos. This macro
parameter is typically set in the driver module to capture the SASAutos
value at the start of the SAS Clinical Standards Toolkit process (before
calling %cstutil_allocatesasreferences). This parameter is ignored
if _cstInitSASAutos does not exist.
|
|
Clear all filerefs and
librefs included in SASReferences, except any autocall filerefs.
|
|
Reset the fmtsearch
path based on the fmtsearch value at the start of the SAS Clinical
Standards Toolkit process. This macro parameter is ignored if the
work._cstsessionoptions data set does not exist. To support this functionality,
this data set is created in the %cstutil_processsetup macro before
calling the %cstutil_allocatesasreferences macro.
|
|
Reset all SAS options
back to their status at the start of the SAS Clinical Standards Toolkit
process. This macro parameter is ignored if the work._cstsessionoptions
data set does not exist. To support this functionality, this data
set is created in the %cstutil_processsetup macro before calling the
%cstutil_allocatesasreferences macro.
|
|
Delete files if the
global macro variable _cstDebug=0. Files are &_cstsasrefs, &_cstmessages,
and work._cstsessionoptions.
|
_cstDeleteGlobalMacroVars
|
Call %symdel for all
macro variables found in sashelp.vmacro (where=(lowcase(name) =:"_cst"
and scope="GLOBAL")).
|