Review ask

As a clinical trial statistician or programmer, answer three short questions in Your review: the task, the inputs and outputs, and the AI-assisted review. Agreeing with all three approves this benchmark; disagreeing with any needs a comment. Propose a fix with the Edit button on any source file, or add it to your comments.

We suggest spending no more than 5 minutes on a review. The other tabs beside Your review are background for assessment, not under review.

Summary

Lifecycle: draftEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: give every dose record and every pharmacokinetic (PK) concentration record of a population PK dataset the body weight (WT) and the serum creatinine (CREAT) that applied on its date, and the creatinine clearance (CRCL) those two give.

Input: exposure (EX) records, one per administration, with the dose (EXDOSE) and its date/time (EXSTDTC); PK concentration (PC) records with the collection date/time (PCDTC); vital signs (VS) and laboratory (LB) records, one per subject, test and date (VSDTC, LBDTC), with the numeric result (VSSTRESN in kg for the test WEIGHT, LBSTRESN in umol/L for the test CREAT); and the subject-level dataset (ADSL) with the age in years (AGE) and the sex (SEX). An administration gives a dose record and a sample gives a concentration record.

Variables:

  • ASEQ: the record's number within the subject, in the order of ADTM, a sample before a dose at the same date/time.
  • ADTM: the date/time of the administration or of the sample.
  • EVID: 1 for a dose record and 0 for a concentration record.
  • WT: the subject's latest weight result dated on or before the date of ADTM; empty when there is none.
  • CREAT: the subject's latest creatinine result dated on or before the date of ADTM; empty when there is none.
  • CRCL: the Cockcroft-Gault creatinine clearance in mL/min, not rounded: (140 - AGE) x WT x 1.23 / CREAT for a male subject, with 1.04 in place of 1.23 for a female subject; empty when WT or CREAT is empty.

Note: a result counts from its date onward, whatever the time of day of the record, and a result dated after the record is never used. A record of the test with no result, such as a weight not measured at a visit, is passed over, so the earlier result stays in force.

Inputs

Under review
5 source files

input/adsl.csv

Edit
2 rows
input/adsl.csv
STUDYIDUSUBJIDAGEAGEUSEX
YAMAA-0154YEARSM
YAMAA-0167YEARSF

input/ex.csv

Edit
3 rows
input/ex.csv
STUDYIDUSUBJIDEXSEQEXTRTEXDOSEEXDOSUEXSTDTC
YAMAA-011DRUG X100mg2025-03-10T08:00
YAMAA-012DRUG X100mg2025-03-17T08:00
YAMAA-011DRUG X100mg2025-03-10T09:00

input/lb.csv

Edit
4 rows
input/lb.csv
STUDYIDUSUBJIDLBSEQLBTESTCDLBSTRESNLBSTRESUVISITLBDTC
YAMAA-011ALT31U/LSCREENING2025-03-03
YAMAA-012CREAT88umol/LSCREENING2025-03-03
YAMAA-013CREAT97umol/LWEEK 22025-03-24
YAMAA-011CREAT71umol/LDAY 22025-03-11

input/pc.csv

Edit
7 rows
input/pc.csv
STUDYIDUSUBJIDPCSEQPCTESTCDPCTPTPCDTC
YAMAA-011DRGX2 h2025-03-10T10:00
YAMAA-012DRGXPre-dose2025-03-17T07:30
YAMAA-013DRGXWeek 22025-03-24T09:00
YAMAA-014DRGXWeek 42025-04-07T09:00
YAMAA-011DRGX2 h2025-03-10T11:00
YAMAA-012DRGX24 h2025-03-11T09:00
YAMAA-013DRGXWeek 12025-03-18T09:00

input/vs.csv

Edit
6 rows
input/vs.csv
STUDYIDUSUBJIDVSSEQVSTESTCDVSSTRESNVSSTRESUVSSTATVISITVSDTC
YAMAA-011HEIGHT176cm—SCREENING2025-03-03
YAMAA-012WEIGHT80kg—SCREENING2025-03-03
YAMAA-013WEIGHT78.5kg—WEEK 12025-03-17
YAMAA-014WEIGHT——NOT DONEWEEK 32025-03-31
YAMAA-011WEIGHT61.2kg—SCREENING2025-03-04
YAMAA-012WEIGHT60.4kg—WEEK 12025-03-18

Expected output

Under review
10 expected rows

expected/adppk.csv

Edit
10 rows
expected/adppk.csv
STUDYIDUSUBJIDASEQADTMEVIDWTCREATCRCL
YAMAA-0112025-03-10T08:00:001808896.16363636363636
YAMAA-0122025-03-10T10:00:000808896.16363636363636
YAMAA-0132025-03-17T07:30:00078.58894.36056818181818
YAMAA-0142025-03-17T08:00:00178.58894.36056818181818
YAMAA-0152025-03-24T09:00:00078.59785.60546391752577
YAMAA-0162025-04-07T09:00:00078.59785.60546391752577
YAMAA-0112025-03-10T09:00:00161.2——
YAMAA-0122025-03-10T11:00:00061.2——
YAMAA-0132025-03-11T09:00:00061.27165.4409014084507
YAMAA-0142025-03-18T09:00:00060.47164.5854647887324
Shaded columns are derived— = missing value

Human review and assessment

Your review

3 questions and your comments · View benchmark discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADPPKSTUDYIDStudy IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADPPKUSUBJIDUnique Subject IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADPPKADTMAnalysis Date/TimenumericISO 8601Set per constructed row; see the Row construction sheet.Derived
ADPPKEVIDEvent IDnumeric0, 1Set per constructed row; see the Row construction sheet.Derived
ADPPKWTBody Weight (kg)numericTake VSSTRESN from the last VS record whose STUDYID equals STUDYID and USUBJID equals USUBJID, where ADT is VSDTC or more, and a record with no VSDTC never matches, where VS.VSTESTCD = 'WEIGHT' AND VS.VSSTRESN IS NOT NULL, ordered by VS.VSDTC then VS.VSSEQ, and no match yields blank.Derived
ADPPKCREATSerum Creatinine (umol/L)numericTake LBSTRESN from the last LB record whose STUDYID equals STUDYID and USUBJID equals USUBJID, where ADT is LBDTC or more, and a record with no LBDTC never matches, where LB.LBTESTCD = 'CREAT' AND LB.LBSTRESN IS NOT NULL, ordered by LB.LBDTC then LB.LBSEQ, and no match yields blank.Derived
ADPPKCRCLCreatinine Clearance (mL/min)numericIf SEX = 'M' then compute (140 - AGE) * WT * 1.23 / CREAT; If SEX = 'F' then compute (140 - AGE) * WT * 1.04 / CREAT; otherwise blank.Derived
ADPPKASEQAnalysis Sequence NumbernumericRow number within each group of STUDYID, USUBJID, ordered by ADTM then EVID.Derived
TemplateInclude whenSTUDYIDUSUBJIDADTMEVID
doseCopy EX.STUDYIDCopy EX.USUBJIDCopy EX.EXSTDTCConstant "1"
concentrationCopy PC.STUDYIDCopy PC.USUBJIDCopy PC.PCDTCConstant "0"
VariablePermitted values
EVID0, 1
VersionDateAuthorDescriptionReviewerSign-off
1.82026-11-19yamaa docs buildState open and closed range endpoints, including bounds of zero
1.72026-10-20yamaa docs buildRead a specification in the 1.0 surface as its 0.5 counterpart; state that missing values stay missing where a mapping declares no missing handler, and leave out a declared missing answer that restates a handler's default
1.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName collected precision in words instead of letter codes; state imputation fallbacks, minimum source precision, bounds ignored outside the collected period, and invalid text with no handler as an error; describe date and datetime shifts, imputation flag codes, and partial text giving no date part
1.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
1.32026-09-29yamaa docs buildShow study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata
1.22026-09-29yamaa docs buildClassify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived
1.12026-09-29yamaa docs buildResolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML
1.0yamaa docs buildInitial generation from spec.yaml

Agent prompt

The request an agent receives with the input files; each tier states no more than the one above

prompts/adam-adppk-time-varying-covariates/full.md

Edit
32 lines

Following CDISC ADaM standards, use the provided ADSL, EX, LB, PC, and VS datasets to create an ADPPK dataset with one record per administration in EX and per sample in PC.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, ADTM, EVID, WT, CREAT, CRCL

  • An EX administration gives a dose record: EVID is 1 and ADTM is the date/time of the administration (EXSTDTC).
  • A PC sample gives a concentration record: EVID is 0 and ADTM is the date/time of the sample (PCDTC).
  • ADTM is written as YYYY-MM-DDThh:mm:ss, with the seconds always shown.
  • ASEQ is the record's number within the subject, from 1, in the order of ADTM, a sample before a dose at the same date/time.
  • WT is the subject's latest weight result (VSSTRESN of the VS test "WEIGHT", in kg) dated on or before the date of ADTM.
  • CREAT is the subject's latest creatinine result (LBSTRESN of the LB test "CREAT", in umol/L) dated on or before the date of ADTM.
  • A result counts from its date onward, whatever the time of day of the record, and a result dated after the record is never used.
  • A record of the test with no result, such as a weight not measured at a visit, is passed over, so the earlier result stays in force.
  • WT or CREAT has no value when the subject has no result dated on or before the date of ADTM.
  • CRCL is the Cockcroft-Gault creatinine clearance in mL/min, not rounded: (140 - AGE) x WT x 1.23 / CREAT for a male subject (SEX "M"), with 1.04 in place of 1.23 for a female subject (SEX "F"), AGE and SEX being the subject's ADSL values.
  • CRCL has no value when WT or CREAT has no value.

Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.

prompts/adam-adppk-time-varying-covariates/conventions.md

Edit
13 lines

Following CDISC ADaM standards, use the provided ADSL, EX, LB, PC, and VS datasets to create an ADPPK dataset with one record per administration in EX and per sample in PC.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, ADTM, EVID, WT, CREAT, CRCL

  • EVID is 1 for a dose record and 0 for a concentration record.
  • ADTM is written as YYYY-MM-DDThh:mm:ss, with the seconds always shown.
  • CRCL is the Cockcroft-Gault creatinine clearance, not rounded.

Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.

prompts/adam-adppk-time-varying-covariates/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided ADSL, EX, LB, PC, and VS datasets to create an ADPPK dataset with one record per administration in EX and per sample in PC.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, ADTM, EVID, WT, CREAT, CRCL

Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.

yamaa code

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

Edit
3 lines
import yamaayamaa.spec("spec.yaml").run().output

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adppk-time-varying-covariates/result.R

Edit
70 lines
# Reference solution for the yamaa benchmark adam-adppk-time-varying-covariates (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.suppressPackageStartupMessages({  library(dplyr)  library(readr)})read_src <- function(name) {  read_csv(file.path("/app/input", paste0(name, ".csv")),           col_types = cols(.default = col_character()), na = "")}adsl <- read_src("adsl")ex <- read_src("ex")lb <- read_src("lb")pc <- read_src("pc")vs <- read_src("vs")full_dtm <- function(x) {  x <- ifelse(nchar(x) == 10, paste0(x, "T00:00"), x)  ifelse(nchar(x) == 16, paste0(x, ":00"), x)}events <- bind_rows(  ex %>% transmute(STUDYID, USUBJID, ADTM = full_dtm(EXSTDTC), EVID = 1L,                   SRCSEQ = as.numeric(EXSEQ)),  pc %>% transmute(STUDYID, USUBJID, ADTM = full_dtm(PCDTC), EVID = 0L,                   SRCSEQ = as.numeric(PCSEQ))) %>%  filter(!is.na(ADTM)) %>%  arrange(USUBJID, ADTM, EVID, SRCSEQ) %>%  group_by(USUBJID) %>%  mutate(ASEQ = row_number()) %>%  ungroup() %>%  mutate(ADT = substr(ADTM, 1, 10))weights <- vs %>%  filter(VSTESTCD == "WEIGHT") %>%  transmute(USUBJID, DT = substr(VSDTC, 1, 10), DTC = VSDTC,            SEQ = as.numeric(VSSEQ), VAL = as.numeric(VSSTRESN)) %>%  filter(!is.na(VAL), !is.na(DT))creats <- lb %>%  filter(LBTESTCD == "CREAT") %>%  transmute(USUBJID, DT = substr(LBDTC, 1, 10), DTC = LBDTC,            SEQ = as.numeric(LBSEQ), VAL = as.numeric(LBSTRESN)) %>%  filter(!is.na(VAL), !is.na(DT))latest <- function(results, usubjid, adt) {  vapply(seq_along(usubjid), function(i) {    r <- results %>%      filter(USUBJID == usubjid[i], DT <= adt[i]) %>%      arrange(DT, DTC, SEQ)    if (nrow(r) == 0) NA_real_ else r$VAL[nrow(r)]  }, numeric(1))}adppk <- events %>%  mutate(WT = latest(weights, USUBJID, ADT),         CREAT = latest(creats, USUBJID, ADT)) %>%  left_join(adsl %>% transmute(USUBJID, AGE = as.numeric(AGE), SEX), by = "USUBJID") %>%  mutate(FACTOR = case_when(SEX == "M" ~ 1.23, SEX == "F" ~ 1.04, TRUE ~ NA_real_),         CRCL = (140 - AGE) * WT * FACTOR / CREAT) %>%  select(STUDYID, USUBJID, ASEQ, ADTM, EVID, WT, CREAT, CRCL)write_csv(adppk, file.path("/app/output", "adppk.csv"), na = "")

solutions/adam-adppk-time-varying-covariates/result.py

Edit
108 lines
# Reference solution for the yamaa benchmark adam-adppk-time-varying-covariates (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.import pandas as pdIN = "/app/input"OUT = "/app/output/adppk.csv"def read(name):    return pd.read_csv(f"{IN}/{name}.csv", dtype=str, keep_default_na=False)def adtm(value):    value = value.strip()    date, _, time = value.partition("T")    parts = [p for p in time.split(":") if p != ""] if time else []    parts = (parts + ["00", "00", "00"])[:3]    parts[2] = parts[2].split(".")[0].zfill(2)    return f"{date}T{parts[0].zfill(2)}:{parts[1].zfill(2)}:{parts[2]}"def results(frame, testcd_col, testcd, value_col, date_col, seq_col):    rows = frame[frame[testcd_col].str.strip() == testcd].copy()    rows["value"] = pd.to_numeric(rows[value_col].str.strip(), errors="coerce")    rows = rows[rows["value"].notna()]    rows["date"] = rows[date_col].str.strip().str[:10]    rows = rows[rows["date"].str.len() == 10]    rows["seq"] = pd.to_numeric(rows[seq_col], errors="coerce")    rows = rows.sort_values(["USUBJID", "date", "seq"], kind="stable")    return {k: list(zip(g["date"], g["value"])) for k, g in rows.groupby("USUBJID")}def latest(history, subject, date):    found = None    for d, v in history.get(subject, []):        if d <= date:            found = v    return founddef text(value):    if value is None:        return ""    if float(value).is_integer():        return str(int(value))    return repr(float(value))adsl = read("adsl")ex = read("ex")pc = read("pc")vs = read("vs")lb = read("lb")weights = results(vs, "VSTESTCD", "WEIGHT", "VSSTRESN", "VSDTC", "VSSEQ")creats = results(lb, "LBTESTCD", "CREAT", "LBSTRESN", "LBDTC", "LBSEQ")subjects = {    r.USUBJID: (pd.to_numeric(r.AGE, errors="coerce"), r.SEX.strip())    for r in adsl.itertuples()}doses = pd.DataFrame({    "STUDYID": ex["STUDYID"],    "USUBJID": ex["USUBJID"],    "ADTM": ex["EXSTDTC"].map(adtm),    "EVID": 1,    "SRCSEQ": pd.to_numeric(ex["EXSEQ"], errors="coerce"),})samples = pd.DataFrame({    "STUDYID": pc["STUDYID"],    "USUBJID": pc["USUBJID"],    "ADTM": pc["PCDTC"].map(adtm),    "EVID": 0,    "SRCSEQ": pd.to_numeric(pc["PCSEQ"], errors="coerce"),})adppk = pd.concat([doses, samples], ignore_index=True)adppk = adppk.sort_values(    ["STUDYID", "USUBJID", "ADTM", "EVID", "SRCSEQ"], kind="stable").reset_index(drop=True)adppk["ASEQ"] = adppk.groupby("USUBJID").cumcount() + 1wt, creat, crcl = [], [], []for r in adppk.itertuples():    date = r.ADTM[:10]    w = latest(weights, r.USUBJID, date)    c = latest(creats, r.USUBJID, date)    age, sex = subjects.get(r.USUBJID, (None, ""))    factor = {"M": 1.23, "F": 1.04}.get(sex)    if w is None or c is None or factor is None or age is None or pd.isna(age):        cl = None    else:        cl = (140 - age) * w * factor / c    wt.append(text(w))    creat.append(text(c))    crcl.append(text(cl))adppk["WT"] = wtadppk["CREAT"] = creatadppk["CRCL"] = crcladppk[["STUDYID", "USUBJID", "ASEQ", "ADTM", "EVID", "WT", "CREAT", "CRCL"]].to_csv(    OUT, index=False, lineterminator="\n")

solutions/adam-adppk-time-varying-covariates/result.sas

Edit
153 lines
/* opensas reference solution for the yamaa benchmark adam-adppk-time-varying-covariates.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */options missing=' ';data adsl;  infile '/app/input/adsl.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $20 USUBJID $40 AGE 8 AGEU $10 SEX $1;  input STUDYID $ USUBJID $ AGE AGEU $ SEX $;  SEX = compress(SEX, "0D"x);run;data ex;  infile '/app/input/ex.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $20 USUBJID $40 EXSEQ 8 EXTRT $40 EXDOSE 8 EXDOSU $10 EXSTDTC $19;  input STUDYID $ USUBJID $ EXSEQ EXTRT $ EXDOSE EXDOSU $ EXSTDTC $;  EXSTDTC = compress(EXSTDTC, "0D"x);run;data pc;  infile '/app/input/pc.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $20 USUBJID $40 PCSEQ 8 PCTESTCD $8 PCTPT $40 PCDTC $19;  input STUDYID $ USUBJID $ PCSEQ PCTESTCD $ PCTPT $ PCDTC $;  PCDTC = compress(PCDTC, "0D"x);run;data vs;  infile '/app/input/vs.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $20 USUBJID $40 VSSEQ 8 VSTESTCD $8 VSSTRESN 8 VSSTRESU $10 VSSTAT $10 VISIT $40 VSDTC $19;  input STUDYID $ USUBJID $ VSSEQ VSTESTCD $ VSSTRESN VSSTRESU $ VSSTAT $ VISIT $ VSDTC $;  VSDTC = compress(VSDTC, "0D"x);run;data lb;  infile '/app/input/lb.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $20 USUBJID $40 LBSEQ 8 LBTESTCD $8 LBSTRESN 8 LBSTRESU $10 VISIT $40 LBDTC $19;  input STUDYID $ USUBJID $ LBSEQ LBTESTCD $ LBSTRESN LBSTRESU $ VISIT $ LBDTC $;  LBDTC = compress(LBDTC, "0D"x);run;/* one record per administration and per sample */data events;  length STUDYID $20 USUBJID $40 ADTM $19 ADT $10 EVID 8 SRCSEQ 8 DTC $19;  keep STUDYID USUBJID ADTM ADT EVID SRCSEQ;  set ex(in=inex) pc(in=inpc);  if inex then do; EVID = 1; DTC = strip(EXSTDTC); SRCSEQ = EXSEQ; end;  else do; EVID = 0; DTC = strip(PCDTC); SRCSEQ = PCSEQ; end;  if length(DTC) = 10 then ADTM = cats(DTC, 'T00:00:00');  else if length(DTC) = 13 then ADTM = cats(DTC, ':00:00');  else if length(DTC) = 16 then ADTM = cats(DTC, ':00');  else ADTM = DTC;  ADT = substr(ADTM, 1, 10);run;proc sort data=events;  by STUDYID USUBJID ADTM EVID SRCSEQ;run;data events;  set events;  by STUDYID USUBJID;  if first.USUBJID then ASEQ = 0;  ASEQ + 1;run;/* covariate results that carry a value */data wt;  set vs;  where VSTESTCD = 'WEIGHT' and VSSTRESN is not missing;  length CDT $10;  CDT = substr(VSDTC, 1, 10);  keep STUDYID USUBJID CDT VSDTC VSSEQ VSSTRESN;run;data creat;  set lb;  where LBTESTCD = 'CREAT' and LBSTRESN is not missing;  length CDT $10;  CDT = substr(LBDTC, 1, 10);  keep STUDYID USUBJID CDT LBDTC LBSEQ LBSTRESN;run;proc sql;  create table ewt as  select e.STUDYID, e.USUBJID, e.ASEQ, w.VSDTC, w.VSSEQ, w.VSSTRESN  from events as e left join wt as w    on e.STUDYID = w.STUDYID and e.USUBJID = w.USUBJID and w.CDT <= e.ADT  order by e.STUDYID, e.USUBJID, e.ASEQ, w.VSDTC, w.VSSEQ;  create table ecr as  select e.STUDYID, e.USUBJID, e.ASEQ, c.LBDTC, c.LBSEQ, c.LBSTRESN  from events as e left join creat as c    on e.STUDYID = c.STUDYID and e.USUBJID = c.USUBJID and c.CDT <= e.ADT  order by e.STUDYID, e.USUBJID, e.ASEQ, c.LBDTC, c.LBSEQ;quit;data ewt;  set ewt;  by STUDYID USUBJID ASEQ;  if last.ASEQ;  WT = VSSTRESN;  keep STUDYID USUBJID ASEQ WT;run;data ecr;  set ecr;  by STUDYID USUBJID ASEQ;  if last.ASEQ;  CREAT = LBSTRESN;  keep STUDYID USUBJID ASEQ CREAT;run;proc sort data=adsl out=adsl_s(keep=STUDYID USUBJID AGE SEX);  by STUDYID USUBJID;run;data adppk0;  merge events(in=ine) ewt ecr;  by STUDYID USUBJID ASEQ;  if ine;run;data adppk;  retain STUDYID USUBJID ASEQ ADTM EVID WT CREAT CRCL;  merge adppk0(in=ine) adsl_s;  by STUDYID USUBJID;  if ine;  CRCL = .;  if not missing(WT) and not missing(CREAT) and not missing(AGE) then do;    if SEX = 'M' then CRCL = (140 - AGE) * WT * 1.23 / CREAT;    else if SEX = 'F' then CRCL = (140 - AGE) * WT * 1.04 / CREAT;  end;  keep STUDYID USUBJID ASEQ ADTM EVID WT CREAT CRCL;run;proc sort data=adppk;  by STUDYID USUBJID ASEQ;run;/* CSV written with full numeric precision; a missing value is an empty field */data _null_;  set adppk;  file '/app/output/adppk.csv';  length line $400 cwt ccreat ccrcl $40;  if _n_ = 1 then put 'STUDYID,USUBJID,ASEQ,ADTM,EVID,WT,CREAT,CRCL';  if missing(WT) then cwt = ''; else cwt = strip(put(WT, best32.));  if missing(CREAT) then ccreat = ''; else ccreat = strip(put(CREAT, best32.));  if missing(CRCL) then ccrcl = ''; else ccrcl = strip(put(CRCL, best32.));  line = catx(',', STUDYID, USUBJID, strip(put(ASEQ, best32.)), ADTM, strip(put(EVID, best32.)));  line = strip(line) || ',' || strip(cwt) || ',' || strip(ccreat) || ',' || strip(ccrcl);  put line;run;