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.
- 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.
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.
%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*/
);- Required: Yes
- Type: Character
- Description: The name of the codelist (e.g., AGEU, PARAMCD, DTYPE).
- 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.
- 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
- Required: No
- Type: Library
- Default: WORK
- Description: The SAS library where the resulting datasets will be saved.
- Required: Yes
- Description: The SAS library where the resulting datasets will be saved.
- CDISC API key
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.
%GetCDISCCodelist(codelistValue=ACN,cdiscapikey= xxxxx);
%GetCDISCCodelist(codelistValue=DTYPE, standard=ADAM,cdiscapikey= xxxxxx);
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.
1.0.0(22Nov2025): Initial version
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).
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)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/))
Load SAS package you want to use with the SPF's %loadPackage() macro.
%loadPackage(packageName)