An Evaluation Framework for LLM-Assisted SAS-to-R Translation Fidelity

The migration of statistical programming workflows from SAS to R in regulated clinical research environments has accelerated, and large language models are increasingly positioned as intermediaries capable of automating this translation. Yet the field lacks a systematic, domain-specific framework for evaluating whether an LLM-produced R program is a faithful translation of its SAS source. Existing metrics drawn from natural language processing and general software engineering—BLEU, CodeBLEU, pass@k, and exact match—capture surface or compilation-level properties but do not address the dimensions of fidelity that matter in pharmaceutical statistics: numerical equivalence of derived datasets, preservation of CDISC implementation logic, auditability of the translation lineage, and resilience to hallucinated functions or silently changed defaults. This paper develops and demonstrates an evaluation framework for LLM-assisted SAS-to-R translation fidelity organised around six dimensions: syntactic translatability, semantic and functional equivalence, data-level numerical agreement, regulatory and audit fidelity, maintainability and idiomaticity, and safety and hallucination resilience. The framework is operationalised through a mixed-method protocol that combines automated program comparison, structured human adjudication, and documentation review. An illustrative application to a corpus of forty clinical programming tasks translated by two commercially available LLMs shows that no single metric predicts overall fidelity and that syntactic similarity is weakly associated with data-level agreement. The paper argues that fidelity in this domain is irreducibly multidimensional and that evaluation must be designed as a compounding, reviewable process rather than a single benchmark score. Implications for programmer training, validation workflow design, and regulatory documentation are discussed.

Authors

Institutions

Publication Details

Journal
Research Square
Published
2026-12-02
DOI
https://doi.org/10.21203/rs.3.rs-11957865/v1
Primary Topic
Software Engineering Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

An Evaluation Framework for LLM-Assisted SAS-to-R Translation Fidelity

McKenzie Izev
Research Square
Software Engineering Research
preprint

An Evaluation Framework for LLM-Assisted SAS-to-R Translation Fidelity

McKenzie Izev
preprint en

Abstract

The migration of statistical programming workflows from SAS to R in regulated clinical research environments has accelerated, and large language models are increasingly positioned as intermediaries capable of automating this translation. Yet the field lacks a systematic, domain-specific framework for evaluating whether an LLM-produced R program is a faithful translation of its SAS source. Existing metrics drawn from natural language processing and general software engineering—BLEU, CodeBLEU, pass@k, and exact match—capture surface or compilation-level properties but do not address the dimensions of fidelity that matter in pharmaceutical statistics: numerical equivalence of derived datasets, preservation of CDISC implementation logic, auditability of the translation lineage, and resilience to hallucinated functions or silently changed defaults. This paper develops and demonstrates an evaluation framework for LLM-assisted SAS-to-R translation fidelity organised around six dimensions: syntactic translatability, semantic and functional equivalence, data-level numerical agreement, regulatory and audit fidelity, maintainability and idiomaticity, and safety and hallucination resilience. The framework is operationalised through a mixed-method protocol that combines automated program comparison, structured human adjudication, and documentation review. An illustrative application to a corpus of forty clinical programming tasks translated by two commercially available LLMs shows that no single metric predicts overall fidelity and that syntactic similarity is weakly associated with data-level agreement. The paper argues that fidelity in this domain is irreducibly multidimensional and that evaluation must be designed as a compounding, reviewable process rather than a single benchmark score. Implications for programmer training, validation workflow design, and regulatory documentation are discussed.

Research Square
AIT Austrian Institute of Technology GmbH (AT)
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon