Datamart Considerations¶
In our usage, a datamart is a curated, analysis-ready subset of the study’s REDCap project, or conceivably of a collection of linked projects. These datasets are intended for statistical analysis, DSMB reporting, study conduct monitoring, and batch error checking. In other words, governed study data in a reproducible format optimized for analytical workflows.
A Hypothetical Datamart Pipeline¶
The following diagram shows how YES3 Exporter II can be used in a build-test-deploy pipeline. At the current time, this process cannot be totally automated, as user action is required to download the zipped export payload, and to extract it into the appropriate secure file location. Full automation will be supported in a future release.
A Windows command script for running SAS¶
Below is an example of a Windows command script, run_sas.cmd, for running SAS in batch mode. When run_sas terminates, it will output the exit code provided by SAS (e.g., ERRORLEVEL). A nonzero exit code indicates failure. This command file is suitable for inclusion in a batch datamart build-test-deploy pipeline.
usage: run_sas path-to-sas-program
example: run_sas C:\Users\criwebtools\testing\eligible_baseline_input.sas
@echo off
REM -----------------------------------------------------------------
REM Restore the environment upon exiting.
REM -----------------------------------------------------------------
setlocal
REM -----------------------------------------------------------------
REM Location of SAS 9.4 executable
REM Adjust this path if SAS is installed elsewhere.
REM -----------------------------------------------------------------
set SAS_EXE="C:\Program Files\SASHome\SASFoundation\9.4\sas.exe"
REM -----------------------------------------------------------------
REM Check that an argument was supplied.
REM %~1 = the first argument passed to this script
REM If nothing is passed, print usage and exit with code 1.
REM -----------------------------------------------------------------
if "%~1"=="" (
echo Usage: %~0 path\to\program.sas
exit /b 1
)
REM -----------------------------------------------------------------
REM Store the full SAS program path (argument #1)
REM -----------------------------------------------------------------
set SASPROG=%~1
REM -----------------------------------------------------------------
REM Path parsing using batch modifiers:
REM %~dp1 = drive + path of argument #1 (e.g., C:\Folder\Subfolder\)
REM %~n1 = filename of argument #1 without extension
REM (e.g., program)
REM
REM Full list of modifiers (only as context for maintainers):
REM %~d1 = drive
REM %~p1 = path
REM %~n1 = file name
REM %~x1 = extension
REM %~f1 = fully qualified path
REM %~dp1 = drive + path
REM -----------------------------------------------------------------
set PROGDIR=%~dp1
set PROGNAME=%~n1
REM -----------------------------------------------------------------
REM Invoke SAS
REM -sysin : program to execute
REM -log : output log file path
REM -print : legacy LIST output file path (.lst)
REM
REM The output files will be written to the SAME directory
REM as the program, with matching base filename.
REM -----------------------------------------------------------------
%SAS_EXE% -sysin "%SASPROG%" -log "%PROGDIR%%PROGNAME%.log" -print "%PROGDIR%%PROGNAME%.lst"
REM -----------------------------------------------------------------
REM Check the ERRORLEVEL immediately after SAS finishes.
REM If non-zero, something went wrong.
REM exit /b makes the script return that error code
REM -----------------------------------------------------------------
if %ERRORLEVEL% neq 0 (
echo SAS execution failed: ERRORLEVEL %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
REM -----------------------------------------------------------------
REM Successful execution
REM -----------------------------------------------------------------
echo SAS completed successfully.
exit /b 0
