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: reviewedEditUnder review
What this benchmark means
README.md

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

Goal: one row per adverse event (AE), marking treatment emergence (TRTEMFL) and the subject's earliest treatment-emergent event (AOCCFL) from onset, first exposure, and the study's post-last-exposure emergence window: 30 days for a non-serious event, 90 days for a serious one.

Input: adverse event records carrying the reported term (AETERM), whether the event was serious (AESER, Y or N, empty when not recorded) and the collected onset moment (ASTDTM, empty when never collected), plus, from the subject-level analysis dataset (ADSL), the moments of first and last exposure (TRTSDTM, TRTEDTM) and the end-of-treatment status (EOTSTT: COMPLETED, DISCONTINUED or ONGOING). While treatment is ongoing, TRTEDTM holds the last exposure so far. An untreated subject appears in ADSL with an empty TRTSDTM and none of their events get flagged.

Variables:

  • TEENDDTM is the end of the treatment-emergent window: 30 days after last exposure for an event recorded as non-serious, and 90 days after for any other event, serious or with its seriousness not recorded. It stays empty while treatment is ongoing, because the window has no end yet, and for an untreated subject.
  • TRTEMFL holds Y when the event started inside the window - at or after first exposure and at or before the window end, or at any time after first exposure while treatment is ongoing. It stays empty for an earlier or later event. A missing onset cannot be ruled pre-treatment, so the conservative convention flags it Y whenever the subject was treated; an untreated subject's events stay empty.
  • AOCCFL holds Y on the subject's earliest treatment-emergent event, ordered by onset moment with the lower sequence number (AESEQ) settling ties at the same second. All other rows stay empty; a treatment-emergent event with a missing onset is flagged but cannot be ordered, so it never carries the occurrence flag.

Note: emergence is decided at the moment, not the day: an event that started earlier on the day of first exposure and one that started later that same day fall on opposite sides, and a start date alone cannot tell them apart. Both window ends belong to the window, and a day is 24 hours, so a serious event one second past 90 days after last exposure is outside it.

Note: a collected datetime without seconds is coerced to the second (seconds zero-filled) and compared at second precision. HEADACHE is collected as 2025-03-04T11:45 and VOMITING as 2025-03-04T11:45:00; both land on the same second, so the AOCCFL tie-break ("the lower sequence number settles ties at the same second") is what picks the earliest treatment-emergent event. No time-imputation flag is derived for the coerced value: the onset is read directly as a date and time, which takes the omitted seconds as collected zeros rather than as supplied ones.

Inputs

Under review
2 source files

input/adsl.csv

Edit
4 rows
input/adsl.csv
STUDYIDUSUBJIDTRTSDTMTRTEDTMEOTSTT
PILOT72025-03-04T09:00:002025-03-10T09:00:00COMPLETED
PILOT72025-03-05T09:00:002025-03-05T09:00:00DISCONTINUED
PILOT7———
PILOT72025-03-06T08:00:002025-05-01T08:00:00ONGOING

input/ae.csv

Edit
15 rows
input/ae.csv
STUDYIDUSUBJIDAESEQAETERMAESERAESTDTC
PILOT71CHILLSN2025-03-04T07:15:00
PILOT72HEADACHEN2025-03-04T11:45
PILOT73NAUSEAN2025-03-06T22:30:00
PILOT74VOMITINGN2025-03-04T11:45:00
PILOT75BACK PAINN2025-04-15T10:00:00
PILOT76COUGHN2025-03-20T08:00:00
PILOT77PNEUMONIAY2025-05-20T14:00:00
PILOT78ARTHRALGIA—2025-04-20T10:00:00
PILOT71RASHN2025-03-05T09:00:00
PILOT72PRURITUSN—
PILOT73DIZZINESSN2025-04-04T09:00
PILOT74SYNCOPEY2025-06-03T09:00:01
PILOT71FATIGUEN2025-03-07T13:05:00
PILOT71INSOMNIAN2025-03-05T22:00:00
PILOT72ALOPECIAN2025-08-12T10:00:00

Expected output

Under review
15 expected rows

expected/adae.csv

Edit
15 rows
expected/adae.csv
STUDYIDUSUBJIDAESEQAETERMAESERASTDTMTRTSDTMTRTEDTMEOTSTTTEENDDTMTRTEMFLAOCCFL
PILOT71CHILLSN2025-03-04T07:15:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-04-09T09:00:00——
PILOT72HEADACHEN2025-03-04T11:45:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-04-09T09:00:00YY
PILOT73NAUSEAN2025-03-06T22:30:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-04-09T09:00:00Y—
PILOT74VOMITINGN2025-03-04T11:45:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-04-09T09:00:00Y—
PILOT75BACK PAINN2025-04-15T10:00:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-04-09T09:00:00——
PILOT76COUGHN2025-03-20T08:00:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-04-09T09:00:00Y—
PILOT77PNEUMONIAY2025-05-20T14:00:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-06-08T09:00:00Y—
PILOT78ARTHRALGIA—2025-04-20T10:00:002025-03-04T09:00:002025-03-10T09:00:00COMPLETED2025-06-08T09:00:00Y—
PILOT71RASHN2025-03-05T09:00:002025-03-05T09:00:002025-03-05T09:00:00DISCONTINUED2025-04-04T09:00:00YY
PILOT72PRURITUSN—2025-03-05T09:00:002025-03-05T09:00:00DISCONTINUED2025-04-04T09:00:00Y—
PILOT73DIZZINESSN2025-04-04T09:00:002025-03-05T09:00:002025-03-05T09:00:00DISCONTINUED2025-04-04T09:00:00Y—
PILOT74SYNCOPEY2025-06-03T09:00:012025-03-05T09:00:002025-03-05T09:00:00DISCONTINUED2025-06-03T09:00:00——
PILOT71FATIGUEN2025-03-07T13:05:00——————
PILOT71INSOMNIAN2025-03-05T22:00:002025-03-06T08:00:002025-05-01T08:00:00ONGOING———
PILOT72ALOPECIAN2025-08-12T10:00:002025-03-06T08:00:002025-05-01T08:00:00ONGOING—YY
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
ADAESTUDYIDStudy IdentifiercharacterCopy value from AE.STUDYID.Predecessor
ADAEUSUBJIDUnique Subject IdentifiercharacterCopy value from AE.USUBJID.Predecessor
ADAEAESEQSequence NumbernumericCopy value from AE.AESEQ.Predecessor
ADAEAETERMReported Term for the Adverse EventcharacterCopy value from AE.AETERM.Predecessor
ADAEAESERSerious EventcharacterCopy value from AE.AESER.Predecessor
ADAEASTDTMAnalysis Start Date/TimenumericISO 8601Copy value from AE.AESTDTC.Predecessor
ADAETRTSDTMDatetime of First Exposure to TreatmentnumericISO 8601Copy value from ADSL.TRTSDTM.Predecessor
ADAETRTEDTMDatetime of Last Exposure to TreatmentnumericISO 8601Copy value from ADSL.TRTEDTM.Predecessor
ADAEEOTSTTEnd of Treatment StatuscharacterCopy value from ADSL.EOTSTT.Predecessor
ADAETEENDDTMEnd of Treatment-Emergent WindownumericISO 8601If EOTSTT = 'ONGOING' then "None"; If AESER = 'N' then the datetime 30 days after TRTEDTM; otherwise the datetime 90 days after TRTEDTM.Derived
ADAETRTEMFLTreatment Emergent Analysis FlagcharacterYIf TRTSDTM IS NULL then "None"; If ASTDTM IS NULL then "Y"; If ASTDTM >= TRTSDTM AND (EOTSTT = 'ONGOING' OR ASTDTM <= TEENDDTM) then "Y"; otherwise "None".Derived
ADAEAOCCFLFirst Occurrence Within Subject FlagcharacterY"Y" when AOCCSEQ = 1; blank otherwise.Derived
VariablePermitted values
TRTEMFLY
AOCCFLY
VersionDateAuthorDescriptionReviewerSign-off
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-adae-onset-emergence/full.md

Edit
28 lines

Following CDISC ADaM standards, use the provided ADSL and AE datasets to create an ADAE dataset with one record per AE record, the events of an untreated subject included.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, AESER, ASTDTM, TRTSDTM, TRTEDTM, EOTSTT, TEENDDTM, TRTEMFL, AOCCFL

Treatment emergence is decided at the moment, to the second, not the day. A subject is untreated when TRTSDTM has no value.

  • ASTDTM is the collected onset, AESTDTC, as a date and time to the second; an onset collected without seconds falls on second zero. ASTDTM has no value when AESTDTC is empty.
  • TEENDDTM is the end of the treatment-emergent window: 30 days after TRTEDTM when AESER is "N", and 90 days after TRTEDTM for any other event, serious or with AESER not recorded. A day is 24 hours. TEENDDTM has no value when EOTSTT is "ONGOING", and for an untreated subject.
  • TRTEMFL is "Y" when ASTDTM is at or after TRTSDTM and at or before TEENDDTM. When EOTSTT is "ONGOING", TRTEMFL is "Y" for any ASTDTM at or after TRTSDTM. TRTEMFL is also "Y" for an event with no ASTDTM when the subject was treated. TRTEMFL has no value otherwise, and for every event of an untreated subject.
  • AOCCFL is "Y" on the subject's earliest treatment-emergent event by ASTDTM, the lower AESEQ settling a tie at the same second. AOCCFL has no value on every other record, a treatment-emergent event with no ASTDTM included.

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

prompts/adam-adae-onset-emergence/conventions.md

Edit
14 lines

Following CDISC ADaM standards, use the provided ADSL and AE datasets to create an ADAE dataset with one record per AE record, the events of an untreated subject included.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, AESER, ASTDTM, TRTSDTM, TRTEDTM, EOTSTT, TEENDDTM, TRTEMFL, AOCCFL

ASTDTM is a date and time to the second, or has no value. TEENDDTM is a date and time or has no value, and a day is 24 hours. TRTEMFL is "Y" or has no value. AOCCFL is "Y" or has no value.

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

prompts/adam-adae-onset-emergence/brief.md

Edit
10 lines

Following CDISC ADaM standards, use the provided ADSL and AE datasets to create an ADAE dataset with one record per AE record, the events of an untreated subject included.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, AESEQ, AETERM, AESER, ASTDTM, TRTSDTM, TRTEDTM, EOTSTT, TEENDDTM, TRTEMFL, AOCCFL

Read the source datasets from /app/input and save the completed dataset as /app/output/adae.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-adae-onset-emergence/result.R

Edit
96 lines
# Reference solution for the yamaa benchmark adam-adae-onset-emergence (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.# ADAE: treatment emergence decided at the second, one record per AE record.suppressPackageStartupMessages({  library(dplyr)  library(readr)  library(stringr)})in_dir <- "/app/input"out_dir <- "/app/output"dir.create(out_dir, showWarnings = FALSE, recursive = TRUE)read_chr <- function(path) {  read_csv(path, col_types = cols(.default = col_character()),           na = c(""), trim_ws = TRUE, progress = FALSE)}adsl <- read_chr(file.path(in_dir, "adsl.csv"))ae <- read_chr(file.path(in_dir, "ae.csv"))# ISO 8601 datetime text to POSIXct (UTC, so a day is always 24 hours).# A value without seconds falls on second zero; anything else is no value.parse_dtm <- function(x) {  x <- str_trim(x)  full <- case_when(    is.na(x) ~ NA_character_,    str_detect(x, "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$") ~ x,    str_detect(x, "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$") ~ paste0(x, ":00"),    TRUE ~ NA_character_  )  as.POSIXct(full, format = "%Y-%m-%dT%H:%M:%S", tz = "UTC")}fmt_dtm <- function(x) {  out <- format(x, "%Y-%m-%dT%H:%M:%S", tz = "UTC")  out[is.na(x)] <- NA_character_  out}day_secs <- 24 * 60 * 60adsl_t <- adsl %>%  transmute(    STUDYID, USUBJID, EOTSTT,    TRTSDTM = parse_dtm(TRTSDTM),    TRTEDTM = parse_dtm(TRTEDTM)  )adae <- ae %>%  mutate(AESEQ = as.integer(AESEQ), .row = row_number()) %>%  left_join(adsl_t, by = c("STUDYID", "USUBJID")) %>%  mutate(    ASTDTM = parse_dtm(AESTDTC),    treated = !is.na(TRTSDTM),    ongoing = !is.na(EOTSTT) & EOTSTT == "ONGOING",    window_days = if_else(!is.na(AESER) & AESER == "N", 30, 90),    TEENDDTM = if_else(treated & !ongoing,                       TRTEDTM + window_days * day_secs,                       as.POSIXct(NA, tz = "UTC")),    TRTEMFL = case_when(      !treated ~ NA_character_,      is.na(ASTDTM) ~ "Y",      ongoing & ASTDTM >= TRTSDTM ~ "Y",      !ongoing & !is.na(TEENDDTM) & ASTDTM >= TRTSDTM & ASTDTM <= TEENDDTM ~ "Y",      TRUE ~ NA_character_    )  )# AOCCFL: earliest treatment-emergent event with an ASTDTM, lower AESEQ on ties.first_te <- adae %>%  filter(TRTEMFL == "Y", !is.na(ASTDTM)) %>%  arrange(USUBJID, ASTDTM, AESEQ) %>%  group_by(USUBJID) %>%  slice(1) %>%  ungroup() %>%  select(.row)adae <- adae %>%  mutate(AOCCFL = if_else(.row %in% first_te$.row, "Y", NA_character_)) %>%  arrange(.row) %>%  transmute(    STUDYID, USUBJID, AESEQ, AETERM, AESER,    ASTDTM = fmt_dtm(ASTDTM),    TRTSDTM = fmt_dtm(TRTSDTM),    TRTEDTM = fmt_dtm(TRTEDTM),    EOTSTT,    TEENDDTM = fmt_dtm(TEENDDTM),    TRTEMFL, AOCCFL  )write_csv(adae, file.path(out_dir, "adae.csv"), na = "")

solutions/adam-adae-onset-emergence/result.py

Edit
126 lines
# Reference solution for the yamaa benchmark adam-adae-onset-emergence (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."""Derive ADAE (one record per AE record) from ADSL and AE.Treatment emergence is judged to the second."""import csvfrom datetime import datetime, timedeltafrom pathlib import PathINPUT = Path("/app/input")OUTPUT = Path("/app/output")COLUMNS = [    "STUDYID", "USUBJID", "AESEQ", "AETERM", "AESER", "ASTDTM", "TRTSDTM",    "TRTEDTM", "EOTSTT", "TEENDDTM", "TRTEMFL", "AOCCFL",]ISO = "%Y-%m-%dT%H:%M:%S"def parse_dtm(value):    """ISO 8601 date-time to the second; a value without seconds is at second zero."""    value = (value or "").strip()    if not value:        return None    for fmt in (ISO, "%Y-%m-%dT%H:%M"):        try:            return datetime.strptime(value, fmt)        except ValueError:            pass    return Nonedef fmt_dtm(value):    return value.strftime(ISO) if value is not None else ""def read_csv(path):    with open(path, newline="", encoding="utf-8") as handle:        return list(csv.DictReader(handle))def main():    adsl = {        (row["STUDYID"], row["USUBJID"]): row        for row in read_csv(INPUT / "adsl.csv")    }    ae = read_csv(INPUT / "ae.csv")    records = []    for row in ae:        subject = adsl.get((row["STUDYID"], row["USUBJID"]), {})        trtsdtm = parse_dtm(subject.get("TRTSDTM"))        trtedtm = parse_dtm(subject.get("TRTEDTM"))        eotstt = (subject.get("EOTSTT") or "").strip()        aeser = (row.get("AESER") or "").strip()        astdtm = parse_dtm(row.get("AESTDTC"))        treated = trtsdtm is not None        ongoing = eotstt == "ONGOING"        teenddtm = None        if treated and not ongoing and trtedtm is not None:            days = 30 if aeser == "N" else 90            teenddtm = trtedtm + timedelta(days=days)        trtemfl = ""        if treated:            if astdtm is None:                trtemfl = "Y"            elif astdtm >= trtsdtm:                if ongoing:                    trtemfl = "Y"                elif teenddtm is not None and astdtm <= teenddtm:                    trtemfl = "Y"        records.append({            "STUDYID": row["STUDYID"],            "USUBJID": row["USUBJID"],            "AESEQ": int(row["AESEQ"]),            "AETERM": row["AETERM"],            "AESER": aeser,            "ASTDTM": astdtm,            "TRTSDTM": trtsdtm,            "TRTEDTM": trtedtm,            "EOTSTT": eotstt,            "TEENDDTM": teenddtm,            "TRTEMFL": trtemfl,            "AOCCFL": "",        })    records.sort(key=lambda r: (r["STUDYID"], r["USUBJID"], r["AESEQ"]))    # First treatment-emergent event per subject by ASTDTM, lower AESEQ on ties.    first = {}    for rec in records:        if rec["TRTEMFL"] != "Y" or rec["ASTDTM"] is None:            continue        key = (rec["STUDYID"], rec["USUBJID"])        best = first.get(key)        if best is None or (rec["ASTDTM"], rec["AESEQ"]) < (best["ASTDTM"], best["AESEQ"]):            first[key] = rec    for rec in first.values():        rec["AOCCFL"] = "Y"    OUTPUT.mkdir(parents=True, exist_ok=True)    with open(OUTPUT / "adae.csv", "w", newline="", encoding="utf-8") as handle:        writer = csv.writer(handle, lineterminator="\n")        writer.writerow(COLUMNS)        for rec in records:            writer.writerow([                rec["STUDYID"], rec["USUBJID"], rec["AESEQ"], rec["AETERM"],                rec["AESER"], fmt_dtm(rec["ASTDTM"]), fmt_dtm(rec["TRTSDTM"]),                fmt_dtm(rec["TRTEDTM"]), rec["EOTSTT"], fmt_dtm(rec["TEENDDTM"]),                rec["TRTEMFL"], rec["AOCCFL"],            ])if __name__ == "__main__":    main()

solutions/adam-adae-onset-emergence/result.sas

Edit
49 lines
/* opensas reference solution for the yamaa benchmark adam-adae-onset-emergence.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl;  length STUDYID USUBJID TRTSDTM TRTEDTM EOTSTT $1024;  infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRTSDTM : $char1024. TRTEDTM : $char1024. EOTSTT : $char1024.;run;data ae;  length STUDYID USUBJID AETERM AESER AESTDTC $1024;  infile "/app/input/ae.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. AESEQ AETERM : $char1024. AESER : $char1024. AESTDTC : $char1024.;run;proc sql; create table joined as select a.*,b.TRTSDTM,b.TRTEDTM,b.EOTSTT from ae as a left join adsl as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;data events;  length ASTDTM TEENDDTM $19 TRTEMFL $1;  set joined; ASTDTM=''; TEENDDTM=''; TRTEMFL='';  /* Datetimes collected without seconds are completed to the second so the     onset and the first exposure compare at the moment, not the day. */  if not missing(AESTDTC) then ASTDTM=cats(AESTDTC,ifc(lengthn(AESTDTC)=16,':00',''));  /* The window ends 30 days after last exposure for an event recorded as     non-serious and 90 days after for any other; while treatment is     ongoing it has no end. Whole days keep the time of day. */  window_days=90;  if AESER='N' then window_days=30;  if upcase(EOTSTT) ne 'ONGOING' and not missing(TRTEDTM) then    TEENDDTM=cats(put(input(substr(TRTEDTM,1,10),yymmdd10.)+window_days,yymmdd10.),substr(TRTEDTM,11));  onset=input(ASTDTM,e8601dt.); treatment=input(TRTSDTM,e8601dt.); window_end=input(TEENDDTM,e8601dt.);  /* The window rule: onset at or after first exposure and, unless     treatment is ongoing, at or before the window end is     treatment-emergent. A missing onset cannot be ruled pre-treatment,     so a treated subject's event with a missing onset is flagged Y; an     untreated subject (no first exposure) is never treatment-emergent. */  if not missing(treatment) then do;    if missing(onset) then TRTEMFL='Y';    else if onset>=treatment and (upcase(EOTSTT)='ONGOING' or (not missing(window_end) and onset<=window_end)) then TRTEMFL='Y';  end;run;proc sort data=events(where=(TRTEMFL='Y' and not missing(onset))) out=eligible; by STUDYID USUBJID onset AESEQ; run;data firstevent; set eligible; by STUDYID USUBJID; if first.USUBJID; keep STUDYID USUBJID AESEQ; run;proc sql; create table result as select a.*,case when not missing(b.AESEQ) then 'Y' else '' end as AOCCFL from events as a left join firstevent as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.AESEQ=b.AESEQ; quit;proc sql;  create table final as select STUDYID, USUBJID, AESEQ, AETERM, AESER, ASTDTM, TRTSDTM, TRTEDTM, EOTSTT, TEENDDTM, TRTEMFL, AOCCFL from result;quit;proc export data=final outfile="/app/output/adae.csv" dbms=csv replace; run;