Export into SAS in CDMS
Table of Contents
SAS is a software suite used for advanced analytics, data management, and statistical analysis. Castor EDC allows you to export collected study data into two SAS-compatible formats: XPT or 7BDAT. Note that the 7BDAT files are generated on a 64-bit Linux machine.
This feature is available at no additional cost but must be enabled on a per-study basis. If you would like to use SAS exports, please contact Castor Support at support@castoredc.com and provide your Study ID. Our team will enable the feature for you.
Exporting Data
Once SAS exports have been enabled, an export can be requested via the Actions menu on the Participants page. More information about requesting can export can be found in the ‘How to export data in CDMS’ article.
When the export is finished, you will receive an email notification with a direct link to download the exported data.
Contents of the export file
The export file will contain the following files:
- Log (CSV)
- Contains information about the exported files and the number of rows exported
- Mapping Table (CSV)
- Lists original variable names alongside their sanitized SAS-friendly versions (truncated as needed)
- Enrichment Report (CSV)
- Lists the variable names per export file and how they are converted to SAS data types
- Formats (XPT or 7BDAT)
- File used to load the data types of the columns into SAS
- Comments (XPT or 7BDAT)
- Custom Verifications (XPT or 7BDAT)
- Field Options (XPT or 7BDAT)
- Source Data Verification for Steps (XPT or 7BDAT)
- Study Data (XPT or 7BDAT)
- Separate Files for Each Repeating Data and Survey (XPT or 7BDAT)
- Study, Repeating Data, and Survey Variable Lists (XPT or 7BDAT)
SAS Export Limitations
Converting Castor EDC files for the SAS export must take into account the following limitations in order for the SAS Export to be successful:
- Please be aware that Study structure element’s names may be adjusted to be suitable with the SAS table format: Names larger than 30 characters will be truncated and will receive a prefix to ensure uniqueness.
- Make sure that the labels (for example, field labels) do not contain any special characters, as the SAS export will not work when the special characters are present. Here is a list of the non-ASCII characters for your reference.
- The SAS 7bdat files are generated in 64-bit Linux environment, therefore they can only be opened on 64-bit Linux environment. If you are using a different environment, we recommend utilizing the XPT files which can be used in any environment.
Values marked as missing
Data marked as user missing is exported as -95, -96, -97, -98, -99.
For time fields, user missing data is exported as:
|
For date fields, user missing data is exported as:
|
For date and time fields, user missing data is exported as:
|
For other fields, when applicable, user missing data is exported as:
|
Importing Data in SAS
After downloading and unzipping your exported data files, you are ready to import them into SAS. The process involves two main steps:
- Importing the Formats File – This step ensures that SAS understands how to interpret variable formats, including user-missing values.
- Importing the Study Datasets – This step makes the actual study data accessible for analysis.
Step 1: Import the Formats File
The formats file tells SAS about variable data types and user-missing value definitions. You must import this file first to ensure all future dataset imports correctly apply these formats.
XPT
/*
Load the formats from the catalog file (formats.xpt) in your unzipped export folder.
Replace <directory name> with the path to your actual folder
For example "/home/u12345678/sasuser.v94/study_sas_xpt_export_YYYYMMDDHHMMSS/formats.xpt"
*/
proc cimport infile="/<directory name>/formats.xpt" lib=WORK;
run;
7BDAT
/*
Create a reference to the folder with your unzipped export data
Replace <directory name> with the path to your actual folder
For example: "/home/u12345678/sasuser.v94/study_sas_7bdat_export_YYYYMMDDHHMMSS/"
*/
libname download "/<directory name>/";
/* Load the data catalog (formats.sas7bcat) by pointing SAS to this library */
OPTIONS fmtsearch = (download.formats);
Step 2: Import the Study Datasets
Once the formats file is in place, you can import each of your data files. This allows SAS to apply the correct data types and user-missing value definitions automatically.
XPT
proc cimport infile="/<directory name>/your_dataset.xpt" lib=WORK;
run;
7BDAT
/*
Create (or update) a dataset named 'dm' by reading the DM.sas7bdat file
located in the 'download' library reference from Step 1
*/
DATA dm;
set download.DM;
RUN;
Once the data has been imported, you can perform your desired analyses using SAS. If you have any questions or require additional assistance, please contact Castor Support.