Agenda
Hands-on Seminar Β· Statistics Denmark Β· 2026
Tools, patterns, and institutional knowledge for a durable open-source migration
Agenda
Foundation
Layer 1
| Tool | Type | Best For | License |
|---|---|---|---|
| CSO Ireland Transcompiler | Shiny app + OpenAI API | NSO context β built by stats office for stats office | MIT / FOSS |
| codeconvert.ai | Browser-based, no signup | Live seminar demos β paste SAS, get R instantly | Free tier |
| Claude 3.7 Sonnet / GPT-4o | Direct API / chat | Module-by-module macro decomposition | Commercial API |
| Brillio / AWS Bedrock | Human-in-the-loop pipeline | Large-scale batch migration with audit trail | Commercial |
| HMS Code2X | Agentic migration tool | Claims ~75% automation; regulated environments | Commercial |
β οΈ All tools handle DATA steps and PROC SQL well β all fail silently on complex SAS macros
Layer 2
| SAS Concept | R Equivalent |
|---|---|
| DATA step | dplyr verbs β mutate, filter, group_by, summarise |
| PROC SQL | dbplyr, dplyr, sqldf |
| PROC MEANS / SUMMARY | summarise(), janitor, gtsummary |
| PROC FREQ | table(), janitor::tabyl() |
| PROC SGPLOT | ggplot2 |
| ODS / RTF output | gt, flextable, Quarto |
| SAS macros | R functions + purrr |
| .sas7bdat files | haven::read_sas() |
| SAS formats / labels | forcats (factor labels) |
The pharmaceutical industry has run the largest regulated SASβR migrations in the world.
Their patterns are directly transferable to national statistics.
Pharmaverse
| SAS Role | Pharmaverse R Package | Equivalent |
|---|---|---|
| PROC IMPORT / .sas7bdat | {haven} | Read SAS datasets; handles date epoch shift |
| SDTM derivation macros | {sdtm.oak} | Map raw data to SDTM domains (DM, AE β¦) |
| ADaM derivation macros | {admiral} | Build ADSL, ADAE, ADTTE with auditable derivations |
| PROC EXPORT / XPT files | {xportr} | Submission-compliant XPT with define.xml metadata |
| RTF/PDF output macros | {r2rtf}, {rtables} | Clinical-quality table output |
| SAS log files | {logrx} | R execution logs mirroring SAS .log format |
| Interactive data review | {teal} | Shiny ADaM explorer |
Each package replaces a process role β not individual lines of code
Merck / PharmaSUG 2025
haven::read_sas() to ingest .sas7bdat without rewriting ETLPROC MIXED β lmer() + emmeans(); check degrees-of-freedom method explicitly{r2rtf} templates and adaptKey Pattern
The {admiral} package publishes a 1,300-line auto-generated AGENTS.md β a README for AI agents, not humans
"Y" or NA, never "N"rOpenSci now requires AGENTS.md as a peer-review artifact β this norm is arriving regardless
β οΈ Watch Out
IF x > 5 where x = . evaluates to FALSE. In R, x > 5 where x = NA returns NA β propagating silently through pipelines. CAMIS working group documents all such discrepancies.str() on imported data and cross-check variable types before any analysis stepResources
Hands-On Seminar
.sas7bdat file; run str(); identify any label-drop issues before touching analysisAutomated tools handle syntax.AGENTS.md handles institutional knowledge.
The latter determines whether migrated code is actually correct.