BookmarkSubscribeRSS Feed

Generating .XPT Files With SAS®, R and Python

Started ‎04-19-2021 by
Modified ‎05-10-2021 by
Views 1,534
Paper 1102-2021
Todd Case and YuTing Tian
Vertex Pharmaceuticals, Boston, USA


The primary purpose of this paper is to first lay out a process of generating a simplified Transport (.xpt) file with RStudio and Python to meet study electronic data submission requirements of the Food & Drug Administration (FDA). The second purpose of this paper is to compare the .xpt files created from three different languages: R, Python and SAS. The paper is the expansion of the original FDA guideline document “CREATING SIMPLIFIED TS.XPT FILES”, published in November, 2019.

Transport files can be created by SAS, as well as open source software, including R and Python. According to the FDA guideline document mentioned above, .xpt files can be created by R and Python. This may allow Pharmaceutical companies to expand use of R and Python beyond data visualization and statistical analysis currently being generated by these two languages. Hopefully, readers can use the process shown in the paper as a template to create .xpt files.


Watch the presentation

Watch Generating .XPT Files With SAS®, R and Python as presented by the authors on the SAS Users channel on YouTube.



Topics Covered

This paper and video includes these topics and examples. Please watch the video and review the attached paper for details.


1) Using SAS to generate final datasets in .xpt format

  • 1.1) Code to generate raw TS domain in SAS
  • 1.2) Export TS.SAS with .xpt format
  • 1.3) Using macro to create .xpt files with SAS

2) Using RStudio to generate final datasets in xpt format

  • 2.1) Code to generate raw TS domain in RStudio
  • 2.2) Export TS.R file with .xpt format
  • 2.3) A fast way to create All .xpt files with RStudio

3) Using Python to generate final datasets in .xpt format

  • 3.1) Code to generate raw TS domain in Python
  • 3.2) Export file with .xpt format

4) Review and Compare generated ts.xpt file in SAS Universal Viewer




Study Data Technical Conformance Guide_v4.5

Technical Rejection Criteria for Study Data



Thanks to the people at SAS Tech Support.

Version history
Last update:
‎05-10-2021 09:49 AM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Article Tags