redcap_export_records_sas: Export Full REDCap Database to SAS

View source: R/redcap.R

redcap_export_records_sasR Documentation

Export Full REDCap Database to SAS

Description

The SAS export capability of REDCap v9.5 is broken such that the generated SAS script has voluminous syntactical errors. This function attempts to replicate the intended functionality of REDCap by downloading the data to a csv file and generating a syntactically correct SAS import script. If sas is found on the path, the script is executed in SAS batch mode to produce the desired sas7bdat file.

Usage

redcap_export_records_sas(
  token,
  filename = timestamp_filename("redcap_sas_export"),
  redcap_uri = "https://redcap.wustl.edu/redcap/api/",
  linesize = 78,
  pagesize = 60
)

Arguments

token

The user-specific string that serves as the password for a project.

filename

The name to be used for all output files (.csv, .sas, .log, and .sas7bdat). Must be a valid SAS name.

redcap_uri

The URI (uniform resource identifier) of the REDCap project.

linesize

SAS linesize system option for formatting any sas output.

pagesize

SAS pagesize system option for formatting any sas output.

Examples

## Not run: 
token <- REDCapR::retrieve_credential_local("~/.REDCapR", 7842)$token
redcap_export_records_sas(token, timestamp_filename("static"))

token <- REDCapR::retrieve_credential_local("~/.REDCapR", 6785)$token
redcap_export_records_sas(token, timestamp_filename("mother"))

## End(Not run)

RoeLabWustl/roelabr documentation built on Aug. 27, 2022, 9:57 a.m.