As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.
- Task: Would a real study need this derivation, specified this way? Does it follow CDISC ADaM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- Expected output: Would independent QC programming reproduce every value from these inputs and rules?
The other tabs beside Comments are background for assessment, not under review.
Summary
README.mdGoal: carry each subject's collected age (AGE) and age units
(AGEU), and derive AGEGR1 and AGEGR1N to pool subjects into age
groups.
Input: demographics (DM) records carrying age (AGE) and age
units (AGEU).
Variables:
AGEGR1is the pooled group:<18when age is below 18,18-64when age is 18 through 64 inclusive, and>64when age is above 64;MissingwhenAGEis missing.AGEGR1Nis the numeric rank ofAGEGR1:1for<18,2for18-64, and3for>64; empty whenAGEis missing.
Note: both variables share the same bands, so the number always
matches the text for each subject. A subject aged exactly 18 or 64
falls in 18-64: boundary ages belong to the middle band.
Inputs
Under review1 source fileinput/dm.csv
Edit10 rows| STUDYID | USUBJID | AGE | AGEU |
|---|---|---|---|
| YAMAA-01 | 6 | YEARS | |
| YAMAA-01 | 17 | YEARS | |
| YAMAA-01 | 18 | YEARS | |
| YAMAA-01 | 23 | YEARS | |
| YAMAA-01 | 42 | YEARS | |
| YAMAA-01 | 64 | YEARS | |
| YAMAA-01 | 65 | YEARS | |
| YAMAA-01 | 72 | YEARS | |
| YAMAA-01 | 91 | YEARS | |
| YAMAA-01 | — | — |
Expected output
Under review10 expected rowsexpected/adsl.csv
Edit10 rows| STUDYID | USUBJID | AGE | AGEU | AGEGR1 | AGEGR1N |
|---|---|---|---|---|---|
| YAMAA-01 | 6 | YEARS | <18 | 1 | |
| YAMAA-01 | 17 | YEARS | <18 | 1 | |
| YAMAA-01 | 18 | YEARS | 18-64 | 2 | |
| YAMAA-01 | 23 | YEARS | 18-64 | 2 | |
| YAMAA-01 | 42 | YEARS | 18-64 | 2 | |
| YAMAA-01 | 64 | YEARS | 18-64 | 2 | |
| YAMAA-01 | 65 | YEARS | >64 | 3 | |
| YAMAA-01 | 72 | YEARS | >64 | 3 | |
| YAMAA-01 | 91 | YEARS | >64 | 3 | |
| YAMAA-01 | — | — | Missing | — |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADSL | STUDYID | Study Identifier | character | Copy value from DM.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADSL | AGE | Age | numeric | Copy value from DM.AGE. | Predecessor | ||
| ADSL | AGEU | Age Units | character | Copy value from DM.AGEU. | Predecessor | ||
| ADSL | AGEGR1 | Pooled Age Group 1 | character | If AGE < 18 then "<18"; If AGE >= 18 AND AGE <= 64 then "18-64"; If AGE > 64 then ">64"; otherwise "Missing". | Derived | ||
| ADSL | AGEGR1N | Pooled Age Group 1 (N) | numeric | If AGEGR1 = '<18' then "1"; If AGEGR1 = '18-64' then "2"; If AGEGR1 = '>64' then "3"; otherwise "None". | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.3 | 2026-09-29 | yamaa docs build | Show study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata | ||
| 1.2 | 2026-09-29 | yamaa docs build | Classify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived | ||
| 1.1 | 2026-09-29 | yamaa docs build | Resolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML | ||
| 1.0 | yamaa docs build | Initial generation from spec.yaml |
prompts/adam-adsl-age-group/full.md
Edit17 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N
Create AGEGR1 using these labels:
- <18
- 18-64
-
64
- Missing
Create AGEGR1N as the numeric code of AGEGR1: 1 for <18, 2 for 18-64, and 3 for >64. AGEGR1N has no value when AGEGR1 is Missing.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-age-group/conventions.md
Edit17 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N
Create AGEGR1 using these labels:
- <18
- 18-64
-
64
- Missing
Create AGEGR1N as the numeric code of AGEGR1: 1 for <18, 2 for 18-64, and 3 for >64. AGEGR1N has no value when AGEGR1 is Missing.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-age-group/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided DM dataset to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
run.R
Edit4 lineslibrary(yamaa)adsl <- yamaa_domain("spec.yaml")$outputadslrun.py
Edit4 linesimport yamaaadsl = yamaa.yamaa_domain("spec.yaml").outputadslsolutions/adam-adsl-age-group/result.R
Edit32 lines# Reference solution for the yamaa benchmark adam-adsl-age-group (R track).## Written from the benchmark's full prompt and its inputs alone, as an agent# would write it. Harbor's oracle agent runs it to check that the prompt can# be solved and that the grader scores a correct answer 1.library(dplyr, warn.conflicts = FALSE)library(readr)dm <- read_csv( "/app/input/dm.csv", col_types = cols(AGE = col_double(), .default = col_character()))adsl <- dm |> mutate( AGEGR1 = case_when( is.na(AGE) ~ "Missing", AGE < 18 ~ "<18", AGE <= 64 ~ "18-64", .default = ">64" ), AGEGR1N = case_when( AGEGR1 == "<18" ~ 1L, AGEGR1 == "18-64" ~ 2L, AGEGR1 == ">64" ~ 3L ) ) |> select(STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")solutions/adam-adsl-age-group/result.py
Edit34 lines# Reference solution for the yamaa benchmark adam-adsl-age-group (Python track).## Written from the benchmark's full prompt and its inputs alone, as an agent# would write it. Harbor's oracle agent runs it to check that the prompt can# be solved and that the grader scores a correct answer 1.from pathlib import Pathimport polars as pldm = pl.read_csv("/app/input/dm.csv", infer_schema=False)age = pl.col("AGE").cast(pl.Float64)agegr1 = ( pl.when(age.is_null()) .then(pl.lit("Missing")) .when(age < 18) .then(pl.lit("<18")) .when(age <= 64) .then(pl.lit("18-64")) .otherwise(pl.lit(">64")))agegr1n = pl.col("AGEGR1").replace_strict( {"<18": 1, "18-64": 2, ">64": 3}, default=None, return_dtype=pl.Int64)adsl = ( dm.with_columns(AGEGR1=agegr1) .with_columns(AGEGR1N=agegr1n) .select("STUDYID", "USUBJID", "AGE", "AGEU", "AGEGR1", "AGEGR1N"))Path("/app/output").mkdir(exist_ok=True)adsl.write_csv("/app/output/adsl.csv")solutions/adam-adsl-age-group/result.sas
Edit23 lines/* opensas reference solution for the yamaa benchmark adam-adsl-age-group. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm; length STUDYID USUBJID AGEU $1024; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AGE AGEU : $char1024.;run;data result; length AGEGR1 $7; set dm; if missing(AGE) then do; AGEGR1='Missing'; AGEGR1N=.; end; else if AGE < 18 then do; AGEGR1='<18'; AGEGR1N=1; end; else if AGE <= 64 then do; AGEGR1='18-64'; AGEGR1N=2; end; else do; AGEGR1='>64'; AGEGR1N=3; end;run;proc sql; create table final as select STUDYID, USUBJID, AGE, AGEU, AGEGR1, AGEGR1N from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions