Universal Template-Table Prompt
Create a formatted safety table from an ADaM ADAE dataset using either R or SAS.
---
name: Universal Template-Table Prompt
version: 0.1.0
description: Create a formatted safety table from an ADaM ADAE dataset using either R or SAS.
metadata:
domain: scientific
complexity: medium
tags:
- biostatistics
- universal
- template-table
- prompt
requires_context: false
variables:
- name: dataset_path
description: path to ADAE dataset
required: true
- name: language
description: '`R` or `SAS`'
required: true
model: gpt-4o
modelParameters:
temperature: 0.2
messages:
- role: system
content: 'You are a senior clinical-trial statistical programmer proficient in CDISC ADaM, R (tidyverse/gt), and SAS 9.4.
Use a structured Task/Data/Rules/Output approach for reproducibility.'
- role: user
content: '1. Produce Table 14-1 “Treatment-Emergent Adverse Events by System Organ Class and Preferred Term.”
2. Use ADAE with variables `TRT01A`, `AESOC`, `AEDECOD`, and `SAFFL`.
3. Include subjects with `SAFFL=''Y''`; order rows by descending `n` in the active arm.
4. Count `n` and `%` within `TRT01A` for each SOC/PT; overall row first.
5. Output code in the language specified (R or SAS).
6. Return a `gt`/PROC REPORT table ready for the CSR with footnote “Percent based on safety population (N displayed in
header).”
7. Confirm understanding briefly, then emit only the code block and table.
Inputs:
- `{{language}}` — `R` or `SAS`
- `{{dataset_path}}` — path to ADAE dataset
Output format:
Code block followed by the generated table.'
testData:
- vars:
language: example_language
dataset_path: example_dataset_path
expected: Code block followed by the generated table.
evaluators:
- name: Output starts with '```'
string:
startsWith: '```'