Skip to main content

SAS Migration to R

#industry #finance #lifesciences #other

Convert SAS Code and Business Logic to R

Migrate business-critical SAS applications to an R-based target architecture. HMS combines code analysis, AI-powered transformation, and domain-specific validation into a transparent migration process.

Request a PoC for your SAS to R migration

When migrating from SAS to R, business-critical functions and domain logic from legacy SAS codebases must be replicated in a new system environment. A SAS-to-R migration therefore involves more than simply transferring individual blocks of code.

Macros, dependencies, data access, and calculation logic must be analyzed, implemented in R, and reviewed for business accuracy. Companies often use the migration as an opportunity to further develop existing workflows and their analytics architecture. In regulated environments, validation and documentation requirements come into play as well.

HMS combines AI-driven automation with SAS and R expertise. We support the entire process from code analysis and target architecture through transformation, testing, and integration of the R code into the target environment.

Why SAS-to-R Migration Is Challenging

SAS and R differ in terms of language logic, data processing, and available functions. Macros, formats, data access methods, and implicit dependencies therefore cannot be transferred without proper business and technical context.

Before the migration, it must also be determined how the R code is to be structured, integrated, tested, and operated. The selected packages, interfaces, and validation requirements determine the translation strategies and the subsequent verification of the results.

Our Approach

Migration from SAS to R with HMS

HMS combines a defined migration workflow with Code2X and AI agents. Automation handles appropriate analysis and transformation steps. Our experts develop the translation strategies, review the generated R code, and address project-specific special cases.

Define the Appropriate Migration Workflow

Depending on the codebase, target architecture, and regulatory requirements, we combine automated code analysis, transformation strategies, and technical review. The workflow is tailored to the specific scope of the project prior to implementation.

Using Automation Strategically

Not everything can or should be automated. When used correctly, automation reduces the effort required for migration, increases consistency, and lightens the workload for experts. Domain and technical decisions remain with experts who understand the business logic, target architecture, and validation requirements.

Combining SAS, R, and AI Expertise

A SAS to R migration requires knowledge of both technologies and experience with AI-powered code transformation. HMS combines these capabilities with project experience in regulated industries such as pharmaceuticals and finance.

Proof of Concept

Assessing the Automation Potential of Your SAS Codebase

We examine representative code examples and assess which components can be transformed automatically. Based on this, we can estimate the effort involved, define the target architecture, and define the scope of a potential proof of concept.

Request a PoC for your SAS to R migration

Experience from SAS migration projects

6,000+

Person-days of experience in modernizing legacy systems

75%

Typical level of automation

35+

AI and migration experts
 

Platforms

Technology Partners for Your Target Architecture

HMS works with leading technology providers and maintains certified partnerships across the data and cloud ecosystem.

Sample Project Workflow

SAS to R Migration Workflow

The following diagram illustrates a migration workflow from a real-world SAS-to-R-project in the pharmaceutical industry from the year 2025.

The code transformation process generally consists of three phases: assessment, exploration, and execution.

Assessment

During the assessment, we focus on project planning, detailed code analysis, defining the target architecture, and specifying requirements.

Exploration

During the exploration phase, we validate technical feasibility and lay the groundwork for automation. To do this, we create a proof of concept, develop migration strategies, and verify that the results from SAS and R match.

Execution

The execution phase encompasses the actual migration using supporting tools such as Code2X and AI agents. Automation is used to break down the code and implement the translation strategies, resulting in an initial R version.

Our experts iteratively revise, refine, and test this code. This allows us to verify its accuracy, compliance, and maintainability within the intended project context.

PHUSE EU Connect

Case Study from the Pharmaceutical Industry

The article “Leveraging AI for Seamless SAS to R Migration: Challenges and Opportunities,” published as part of PHUSE EU Connect 2025, describes an initiative to migrate SAS macros and templates for PK/PD analyses to R.

Why

The migration aims to eliminate tool switching in PK/PD workflows, enable advanced analytics, and create a shared environment for data analysis and AI integration.

What

The focus was on a a SAS codebase for generating analysis-ready datasets in pharmacological and bioinformatics workflows, including NCA, PopPK, PBPK, and gene expression analyses.

Where

The R code was implemented using using base R together with packages from the tidyverse and pharmaverse ecosystems. The domain-specific selection combined existing SAS logic with modern data processing and CDISC-compliant workflows.

How

We started with an exploratory setup using the ellmer R package to interact with LLMs and generate structured outputs in Posit Workbench Pro. This setup was gradually expanded to include automation as the project progressed.

The project confirmed the technical feasibility of GenAI-supported code transformation. At the same time, it highlighted the areas where expert review and integration into validated environments remain necessary.

 Download the presentation

Contact Us Now

Would you like to know how your SAS code can be migrated in practice?

Karsten Wohlgefahrt
Karsten Wohlgefahrt
Principal Sales Manager

During an initial meeting, we’ll work together to clarify the general parameters of your project and identify suitable starting points for further planning and implementation.

Durch das Absenden akzeptiere ich die Datenschutzerklärung.

You Might Also Like

Read more

Code Transformation with Code2X

Code2X analyzes code, applies project-specific transformation strategies, and supports the processing of large code repositories. The tool's general functionality is explained on the Code2X page.

Get to Know Code2X

Read more

Other Approaches to SAS Migration

Not every SAS environment will be fully migrated to R. The main SAS migration page outlines additional target scenarios, including SAS Viya, hybrid architectures, and replacement with other open technologies.

SAS Migration at a Glance