Skip to content

Latest commit

 

History

History
85 lines (59 loc) · 4.05 KB

README.md

File metadata and controls

85 lines (59 loc) · 4.05 KB

Dataset-JSON SAS Implementation

This repository shows a SAS implementation for converting Dataset-JSON files to and from SAS datasets following the CDISC Dataset-JSON v1.1 specification. Test programs are in the programs folder. It is recommended to run the test programs in the following order:

  • 01_convert_xpt.sas
  • 02_create_metadata_from_definexml.sas
  • 03_update_metadata.sas
  • 04_write_datasetjson.sas
  • 05_read_datasetjson.sas
  • 06_compare_data.sas
  • 07_validate_datasetjson.sas

The purpose of the test programs is to demonstrate the macros. The user at a minimum has to update the macro variable that points to the location of the repository clone:

%* update this location to your own location;
%let project_folder=<your project location>;

Other updates in the test programs may be needed to make them work in a specific SAS environment. The macros should work in any SAS environment with at least SAS 9.4 (TS1M7). This was tested on Windows 10 and SAS OnDemand (Linux).

The 07_validate_datasetjson.sas program assumes that your SAS environment is able to run Python objects. Check the program for the Python configuration. Python objects require environment variables to be set before you can use Python objects in your SAS environment. If the environment variables have not been set, or if they have been set incorrectly, SAS returns an error when you publish your Python code. Environment variable related errors can look like these examples:

ERROR: MAS_PYPATH environment variable is undefined.
ERROR: The executable C:\file-path\python.exe cannot be located
       or is not a valid executable.

In the 07_validate_datasetjson.sas program you will need to update the evironment variables that configure the Python environment:

options set=MAS_PYPATH="<your Python executable>";
options set=MAS_M2PATH="<your SAS system root>/tkmas/sasmisc/mas2py.py";

Also, this program assumes that your Python environment has the following packages:

  • json
  • jsonschema

More information:

Documentation

Documentation is in the doc folder (not updated yet for Dataset-JSON v1.1):

Example Data

  • ADaM: ADaM Metadata Submission Guidelines v1.0, 18 April 18 2023
  • SDTM: SDTM Metadata Submission Guidelines v2.0, published 30 March 2021
  • SEND: CBER Pilot (with updated stylesheet)

Additional programs

The test_big_xpt folder contains a SAS program to create a large XPT file (5Gb) from the XPT file data/sdtm/lb.xpt. The program will then create a Dataset-JSON file from that large XPT file, and also convert that large Dataset-JSON file back to a SAS dataset.

The test_datetime folder contains a SAS program to test numeric date/time variables.

Issues

When encountering issues, please open an issue at https://github.com/lexjansen/dataset-json-sas/issues.

License

License: MIT This project is using the MIT license (see LICENSE).

The macros cstutilcheckvarsexist.sas, cstutilgetattribute.sas, cstutilnobs.sas, cstutilxptread.sas, cstutilxptwrite.sas are licensed under the Apache 2.0 License.