Skip to content

PharmaForest/GetCDISCCodelist

Repository files navigation

GetCDISCCodelist

SAS Macro for Fetching CDISC Controlled Terminology (CT) Codelists

This SAS macro retrieves and filters CDISC Controlled Terminology (CT) codelists for various CDISC standards (SDTM, ADaM, CDASH, etc.). The macro interacts with the CDISC Terminology API to fetch the latest terminology version and filters the codelists based on the specified input parameters.

This repository is an adapted version of Saikrishnareddy Yengannagari’s original package (https://github.com/kusy2009/getCDISCCOdelist) tailored for the SAS Package Framework, and the original license remains the property of Saikrishnareddy Yengannagari.  

GetCDISCCodelist_small

Features

  • Dynamic Version Fetching: Automatically fetches the latest version of Controlled Terminology (CT) if not specified.
  • Multiple Standards Support: Supports multiple CDISC standards including SDTM, ADaM, CDASH, DEFINE-XML, SEND, and others.
  • Flexible Filtering: Allows filtering by codelist ID or CodelistCode.
  • Extensible Data: Flags if the codelist is extensible (i.e., if it supports additional terms beyond the official list).
  • Error Handling: Provides detailed error messages if the provided codelist or standard is invalid.

Prerequisites

Before you can use this macro, make sure you have the following:

  • CDISC API Access: You will need an API Key for the CDISC API. If you don’t have one, you can obtain it from CDISC's website.

Syntax

%macro GetCDISCCodelist(
    codelistValue=,  /* The codelist name (e.g., AGEU, PARAMCD) */
    codelistType=ID,  /* Match by ID or CodelistCode */
    standard=SDTM,  /* Default to SDTM */
    version=%str(), /* Version of Controlled Terminology (empty to pull latest) */
    outlib=WORK,/* Output Library */
    cdiscapikey=  /*CDISC API key*/
);

Parameters

codelistValue

  • Required: Yes
  • Type: Character
  • Description: The name of the codelist (e.g., AGEU, PARAMCD, DTYPE).

codelistType

  • Required: No
  • Type: Character (ID or CodelistCode)
  • Default: ID
  • Description: Specify whether to filter by ID or CodelistCode. By default, the macro will filter by ID.

standard

  • Required: No
  • Type: Character
  • Default: SDTM
  • Description: The CDISC standard for which to retrieve the codelist. Valid values include:
    • SDTM (default)
    • ADAM
    • CDASH
    • DEFINE-XML
    • SEND
    • DDF
    • GLOSSARY
    • MRCT
    • PROTOCOL
    • QRS
    • QS-FT
    • TMF

outlib

  • Required: No
  • Type: Library
  • Default: WORK
  • Description: The SAS library where the resulting datasets will be saved.

cdiscapikey

  • Required: Yes
  • Description: The SAS library where the resulting datasets will be saved.
  • CDISC API key

Output

The macro generates the following outputs:

  • Merged Codelist Dataset: A dataset containing the codelist values and their associated terms.
  • Extensibility Flag: If the codelist is extensible, the output dataset will include a flag indicating so.
  • Filtered Codelists: The codelist is filtered based on the provided codelistValue and codelistType parameters.

Example_Usage

%GetCDISCCodelist(codelistValue=ACN,cdiscapikey= xxxxx);
image image
%GetCDISCCodelist(codelistValue=DTYPE, standard=ADAM,cdiscapikey= xxxxxx);
image

Conclusion

This macro can be a very useful tool for fetching and working with CDISC Controlled Terminology (CT) codelists in your clinical trial datasets. If you have any questions or suggestions, feel free to reach out or create an issue in the GitHub repository.

version history

1.0.0(22Nov2025): Initial version

What is SAS Packages?

The package is built on top of SAS Packages Framework(SPF) developed by Bartosz Jablonski.

For more information about the framework, see SAS Packages Framework.

You can also find more SAS Packages (SASPacs) in the SAS Packages Archive(SASPAC).

How to use SAS Packages? (quick start)

1. Set-up SAS Packages Framework

First, create a directory for your packages and assign a packages fileref to it.

filename packages "\path\to\your\packages";

Secondly, enable the SAS Packages Framework. (If you don't have SAS Packages Framework installed, follow the instruction in SPF documentation to install SAS Packages Framework.)

%include packages(SPFinit.sas)

2. Install SAS package

Install SAS package you want to use with the SPF's %installPackage() macro.

  • For packages located in SAS Packages Archive(SASPAC) run:

    %installPackage(packageName)
  • For packages located in PharmaForest run:

    %installPackage(packageName, mirror=PharmaForest)
  • For packages located at some network location run:

    %installPackage(packageName, sourcePath=https://some/internet/location/for/packages)

    (e.g. %installPackage(ABC, sourcePath=https://github.com/SomeRepo/ABC/raw/main/))

3. Load SAS package

Load SAS package you want to use with the SPF's %loadPackage() macro.

%loadPackage(packageName)

Enjoy!

About

This SAS macro retrieves and filters CDISC Controlled Terminology (CT) codelists for various CDISC standards (SDTM, ADaM, CDASH, etc.). The macro interacts with the CDISC Terminology API to fetch the latest terminology version and filters the codelists based on the specified input parameters.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
license.sas

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages