Translate SAS to R through a reviewed design document instead of line by line
AI first writes a plain-language design document from the SAS program, a human reviews it, then AI writes R from the document. A Merck paper reports less rework than direct translation on its own unspecified cases.
Reported in literatureHigh risk
Evidence
Reported in literature. PharmaSUG 2026 AI-305 reports averages over unspecified cases: 3 vs 2 rounds, manual revision of 55.2% of lines (direct) vs 38.4% (design-first), agreement with SAS 64.5% vs 80.3%. Case count and model are not stated. The one worked example was a simple macro with broadly similar results. Authors call for broader testing. Conference paper.
Steps
- Ask AI for a design document from the SAS code.
- Review ordering, joins, missing-value and dedup rules.
- Correct the document.
- Ask for R code from the document only.
- Compare R output with SAS output.
Prompt
This is the prompt, typed out. No assistant reply is shown.
Verify before you use it
- The design document matches the SAS intent.
- R output matches SAS output cell by cell.
- Ordering rules and missing handling were checked explicitly.
- Environment details such as paths were adjusted by a human.
- Differences were explained before use.
How it fails
A wrong assumption in the reviewed document is carried faithfully into the R code.