Translate long SAS programs in chunks and watch for silently skipped sections
Practitioners report that ChatGPT handles short, straightforward SAS well but may omit or skip long or complex sections. Splitting programs into pieces and checking coverage is their recommended practice.
Reported in literatureHigh risk
Evidence
Reported in literature. PharmaSUG 2025 AI-242 (Bosak and Varney) is an experience paper using ChatGPT o3-mini-high. The authors say it does well on code of about 200 lines or less, sometimes gives up on or skips long or tricky sections, can still make up functions, and answers inconsistently. Their demonstration was a very short program. No measured error rates.
Steps
- Split the program into logical steps.
- Translate each chunk separately.
- List any comment saying code was not translated.
- Reassemble and run.
- Compare with SAS output.
Prompt
This is the prompt, typed out. No assistant reply is shown.
You
Translate this SAS section to R. After the code, list every SAS statement or macro call that you did not translate or changed, with the reason. Do not skip any statement silently. Section is part of a larger program; state any variables you assumed from earlier sections as OPEN QUESTION.
Rules: use ONLY the input below. Tag anything the input does not state as OPEN QUESTION. Never invent numbers; use placeholders such as xx. Do not claim anything is verified.
INPUT:
[paste input here]
Verify before you use it
- Every SAS statement has an R counterpart or a documented reason.
- Variables created in earlier chunks are consistent.
- Reassembled program runs end to end.
- Results match SAS output.
- No 'TODO' comments remain unresolved.
How it fails
AI leaves out or stubs tricky sections, and the program still runs.
Data rule: No production code with confidential logic or study identifiers. Use public or simulated programs.