Skip to main content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it's official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you're on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

HHS OIG Toolkits for Calculating Opioid Levels and Identifying Patients At Risk of Misuse or Overdose

Programming Code

These programming codes are parts of the Toolkits to assist users in analyzing large datasets of prescription drug claims to identify individuals at risk of opioid abuse or misuse. Download the

SAS Icon SAS programming code and Toolkit [SAS - 18 KB]

R Icon R programming code and Toolkit [R - 26 KB]

SQL programming code and Toolkit [TXT - 16 KB]

Related Information

Video: Using Data to Assess and Evaluate Trends

Combatting the Opioid Crisis: Priority Area

WHAT ARE THE TOOLKITS?

OIG has developed two toolkits that provide detailed steps for using prescription drug claims data to analyze patients' opioid levels to identify certain patients at risk of opioid misuse or overdose. The first toolkit includes SAS programming code. The second toolkit includes R and SQL programming code. Both toolkits are based on the methodology that OIG developed for its extensive work on opioid use in Medicare Part D.

The toolkits provide highly technical information to assist our public and private sector partners—such as Medicare Part D plan sponsors, private health plans, and State Medicaid Fraud Control Units—with analyzing their own prescription drug claims data to help combat the opioid crisis.

WHY DID OIG CREATE THE TOOLKITS?

The opioid crisis remains a public health emergency. As one of the lead Federal agencies fighting health care fraud, OIG is committed to supporting our public and private partners in their efforts to curb the opioid epidemic. These toolkits and the accompanying code can be used to analyze claims data for prescription drugs and identify patients who may be misusing or abusing prescription opioids and may be in need of additional case management or other followup. These toolkits and accompanying code can also be used to answer research questions about opioid utilization. These types of efforts are particularly important given the COVID-19 pandemic. The National Institutes of Health recently issued a warning that individuals with opioid use disorder could be particularly hard hit by COVID-19, as it is a disease that attacks the lungs. Respiratory disease is known to increase mortality risk among people taking opioids.

OIG has developed extensive work on opioid use in Medicare Part D. OIG most recently analyzed opioid levels in Medicare Part D in a data brief entitled Opioid Use Decreased in Medicare Part D, While Medication-Assisted Treatment Increased (OEI-02-19-00390). The data brief identified almost 49,000 Part D beneficiaries who were at serious risk of misuse or overdose. Some of these beneficiaries received extreme amounts of opioids. Others appeared to be "doctor shopping"-i.e., receiving high amounts of opioids from multiple prescribers and multiple pharmacies. The analysis identified beneficiaries who are at risk by calculating their opioid levels using Part D prescription drug data.

WHAT DOES THE TOOLKIT INCLUDE?

These toolkits provide steps to calculate patients' average daily morphine equivalent dose (MED), which converts various prescription opioids and strengths into one standard value. This measure is also called morphine milligram equivalent (MME). The toolkits include a detailed description of the analysis and programming code in three different programming languages (SAS, R, and SQL) that can be applied to the user's own data. The SAS code, R code, and SQL code provide the same data. These data can be used to identify certain patients who are at risk of opioid misuse or overdose. Users can also modify the code to meet their needs, such as identifying patients at varying levels of risk.

There are two toolkits. For the SAS code, use this toolkit (released in 2018). For the R or SQL code, use this toolkit (released in 2020). The toolkits start with the same two chapters: (1) Analysis of Prescription Drug Claims Data; and (2) Explanation of the Programming Code To Conduct the Analysis. The remaining chapters contain the programming code.