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
README.mdPublic entries: Python and R. Passing coverage requires an installed inventory.
Goal: one row per adverse event (AE) with the collected start
and end kept at the precision they were collected (AESTDTC,
AEENDTC), and the study day (AESTDY, AEENDY) filled only when
the date is complete.
Input: long-form Operational Data Model (ODM) data
(input/odm.csv) with one row per collected item, carrying the
collection form (FormOID), the form repeat (FormRepeatKey, the AE
number within the subject), the item (ItemOID), and the stored value
(Value). Each adverse event is one FO.AE form instance holding the
reported term (IT.AE.AETERM) and the collected start and end as
separate year, month, and day items (IT.AE.AESTYR / IT.AE.AESTMO /
IT.AE.AESTDY, IT.AE.AEENYR / IT.AE.AEENMO / IT.AE.AEENDY); a
part that was not collected has no row. Demographics (input/dm.csv)
supplies the subject reference start date (RFSTDTC), empty when the
subject has no usable reference date.
Variables:
AESTDTC/AEENDTCare the collected dates written as ISO 8601 text at the precision collected: a full date (2026-03-15), a year and month (2026-03), or a year alone (2026). The text stops before the first part that was not collected, so a day collected without its month keeps the year alone, and a date without a collected year stays empty. Nothing is imputed, and a part that is not written as its digits stops the run.AESTDY/AEENDYare the study days counted fromRFSTDTC: day 1 is the reference start date, the day before it is -1, and there is no day zero. Only a complete date gets a study day: a partial date has none even when the reference date is known, and no date has one when the reference date is unknown.
Inputs
Under review2 source filesinput/dm.csv
Edit3 rows| STUDYID | USUBJID | RFSTDTC |
|---|---|---|
| YAMAA-01 | 2026-01-10 | |
| YAMAA-01 | 2026-02-01 | |
| YAMAA-01 | — |
input/odm.csv
Edit32 rows| StudyOID | MetaDataVersionOID | SubjectKey | StudyEventOID | StudyEventRepeatKey | FormOID | FormRepeatKey | ItemGroupOID | ItemGroupRepeatKey | ItemOID | Value |
|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AETERM | Headache |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTMO | 03 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTDY | 15 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENMO | 03 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENDY | 20 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AETERM | Nausea |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AESTYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AESTMO | 03 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AEENYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AEENMO | 04 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AEENDY | 02 |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 3 | IG.AE | 1 | IT.AE.AETERM | Fatigue |
| YAMAA-01 | MDV.1 | YAMAA-01-001 | TREATMENT | 1 | FO.AE | 3 | IG.AE | 1 | IT.AE.AESTYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AETERM | Dizziness |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTMO | 01 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTDY | 28 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENMO | 02 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AETERM | Rash |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AEENYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AEENMO | 02 |
| YAMAA-01 | MDV.1 | YAMAA-01-002 | TREATMENT | 1 | FO.AE | 2 | IG.AE | 1 | IT.AE.AEENDY | 10 |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AETERM | Headache |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTMO | 05 |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AESTDY | 01 |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENYR | 2026 |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENMO | 05 |
| YAMAA-01 | MDV.1 | YAMAA-01-003 | TREATMENT | 1 | FO.AE | 1 | IG.AE | 1 | IT.AE.AEENDY | 05 |
Expected output
Under review6 expected rowsexpected/ae.csv
Edit6 rows| DOMAIN | STUDYID | USUBJID | AESEQ | AETERM | AESTDTC | AEENDTC | AESTDY | AEENDY |
|---|---|---|---|---|---|---|---|---|
| AE | YAMAA-01 | 1 | Headache | 2026-03-15 | 2026-03-20 | 65 | 70 | |
| AE | YAMAA-01 | 2 | Nausea | 2026-03 | 2026-04-02 | — | 83 | |
| AE | YAMAA-01 | 3 | Fatigue | 2026 | — | — | — | |
| AE | YAMAA-01 | 1 | Dizziness | 2026-01-28 | 2026-02 | -4 | — | |
| AE | YAMAA-01 | 2 | Rash | — | 2026-02-10 | — | 10 | |
| AE | YAMAA-01 | 1 | Headache | 2026-05-01 | 2026-05-05 | — | — |
Human review and assessment
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | Char | Assigned | Set constant value "AE". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from ODM.StudyOID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from ODM.SubjectKey. | SDTM | 3 | ||||
| AESEQ | Sequence Number | Num | Collected | Copy value from ODM.FormRepeatKey. | SDTM | 4 | ||||
| AETERM | Reported Term for the Adverse Event | Char | Collected | Copy value from ODM.Value where ODM.ItemOID = 'IT.AE.AETERM'. | SDTM | 5 | ||||
| AESTDTC | Start Date/Time of Adverse Event | Char | Derived | Write the collected year AEST_YR, month AEST_MO, day AEST_DY as ISO 8601 date text, stopping before the first blank part; blank when the year is blank; a part that is not its digits is an error. | SDTM | 6 | ||||
| AEENDTC | End Date/Time of Adverse Event | Char | Derived | Write the collected year AEEN_YR, month AEEN_MO, day AEEN_DY as ISO 8601 date text, stopping before the first blank part; blank when the year is blank; a part that is not its digits is an error. | SDTM | 7 | ||||
| AESTDY | Study Day of Start of Adverse Event | Num | Derived | CDISC study day of AESTDT against RFSTDTC as day 1; there is no day zero. | SDTM | 8 | ||||
| AEENDY | Study Day of End of Adverse Event | Num | Derived | CDISC study day of AEENDT against RFSTDTC as day 1; there is no day zero. | SDTM | 9 |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.7 | 2026-10-20 | yamaa docs build | Read 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.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name 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.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 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/sdtm-ae-partial-dates/full.md
Edit21 linesFollowing CDISC SDTM standards, use the provided DM and ODM datasets to create an AE dataset with one record per adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY
STUDYID is the study OID and USUBJID is the subject key, each as given in ODM. AESEQ is the adverse event's number within the subject, the repeat key of its AE form in ODM. AESTDTC and AEENDTC are the collected start and end dates, their year, month, and day collected as separate items in ODM, written as ISO 8601 text at the precision collected: a full date (2026-03-15), a year and month (2026-03) when no day was collected, or a year alone (2026) when no month was collected. Nothing is imputed, and a date with no part collected has no value. AESTDY and AEENDY are the study days of the start and end dates counted from the subject's reference start date, RFSTDTC in DM. Only a complete date gets a study day: a partial date has no study day even when the reference date is known, and neither date has a study day when the subject's RFSTDTC has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-partial-dates/conventions.md
Edit15 linesFollowing CDISC SDTM standards, use the provided DM and ODM datasets to create an AE dataset with one record per adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY
AESTDTC and AEENDTC are the collected start and end dates, written as ISO 8601 text at the precision collected: a full date (2026-03-15), a year and month (2026-03) when no day was collected, or a year alone (2026) when no month was collected. AESTDY and AEENDY are the study days of the start and end dates counted from the subject's reference start date, RFSTDTC in DM.
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
prompts/sdtm-ae-partial-dates/brief.md
Edit8 linesFollowing CDISC SDTM standards, use the provided DM and ODM datasets to create an AE dataset with one record per adverse event.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY
Read the source datasets from /app/input and save the completed dataset as /app/output/ae.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-ae-partial-dates/result.R
Edit87 lines# Reference solution for the yamaa benchmark sdtm-ae-partial-dates (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)library(tidyr)library(stringr)odm <- read_csv( "/app/input/odm.csv", col_types = cols(.default = col_character()))dm <- read_csv( "/app/input/dm.csv", col_types = cols(.default = col_character()))compose_dtc <- function(yr, mo, dy) { ifelse( is.na(yr) | yr == "", NA_character_, ifelse( is.na(mo) | mo == "", yr, ifelse( is.na(dy) | dy == "", paste0(yr, "-", str_pad(mo, 2, pad = "0")), paste0(yr, "-", str_pad(mo, 2, pad = "0"), "-", str_pad(dy, 2, pad = "0")) ) ) )}study_day <- function(adt, ref) { diff <- as.integer(as.Date(adt) - as.Date(ref)) ifelse(is.na(diff), NA_integer_, ifelse(diff >= 0L, diff + 1L, diff))}# One record per form repeat; the repeat number is the sequence number.# Dates stay at the precision collected: nothing is imputed.ae <- odm |> filter(ItemGroupOID == "IG.AE") |> pivot_wider( id_cols = c(StudyOID, SubjectKey, FormRepeatKey), names_from = ItemOID, values_from = Value, values_fn = first ) |> mutate( AESEQ = as.integer(FormRepeatKey), AETERM = `IT.AE.AETERM`, AESTDTC = compose_dtc(`IT.AE.AESTYR`, `IT.AE.AESTMO`, `IT.AE.AESTDY`), AEENDTC = compose_dtc(`IT.AE.AEENYR`, `IT.AE.AEENMO`, `IT.AE.AEENDY`), START_FULL = !is.na(`IT.AE.AESTYR`) & `IT.AE.AESTYR` != "" & !is.na(`IT.AE.AESTMO`) & `IT.AE.AESTMO` != "" & !is.na(`IT.AE.AESTDY`) & `IT.AE.AESTDY` != "", END_FULL = !is.na(`IT.AE.AEENYR`) & `IT.AE.AEENYR` != "" & !is.na(`IT.AE.AEENMO`) & `IT.AE.AEENMO` != "" & !is.na(`IT.AE.AEENDY`) & `IT.AE.AEENDY` != "" ) |> left_join( dm |> select(USUBJID, RFSTDTC), by = c("SubjectKey" = "USUBJID") ) |> # Only a complete date gets a study day, and only when the reference # start date is known. Day 1 is the reference date; there is no day 0. mutate( AESTDY = if_else( START_FULL & !is.na(RFSTDTC) & RFSTDTC != "", study_day(AESTDTC, RFSTDTC), NA_integer_ ), AEENDY = if_else( END_FULL & !is.na(RFSTDTC) & RFSTDTC != "", study_day(AEENDTC, RFSTDTC), NA_integer_ ), DOMAIN = "AE", STUDYID = StudyOID, USUBJID = SubjectKey ) |> arrange(USUBJID, AESEQ) |> select( DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY )dir.create("/app/output", showWarnings = FALSE)write_csv(ae, "/app/output/ae.csv", na = "")solutions/sdtm-ae-partial-dates/result.py
Edit129 lines# Reference solution for the yamaa benchmark sdtm-ae-partial-dates (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."""Build the SDTM AE dataset from DM and ODM long-format inputs.One record per adverse event (one AE form repeat per subject). Start andend dates are assembled from their separately collected year, month, andday items and written as ISO 8601 text at the precision collected; nothingis imputed. Study days are computed only for complete dates and only whenthe subject has a reference start date (RFSTDTC) in DM."""import csvfrom datetime import dateINPUT_DIR = "/app/input"OUTPUT_PATH = "/app/output/ae.csv"COLUMNS = [ "DOMAIN", "STUDYID", "USUBJID", "AESEQ", "AETERM", "AESTDTC", "AEENDTC", "AESTDY", "AEENDY",]def read_csv(path): with open(path, newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))def assemble_date(parts, prefix): """Join collected year/month/day items at the precision collected.""" year = parts.get(prefix + "YR", "").strip() if not year: return "" month = parts.get(prefix + "MO", "").strip() if not month: return year day = parts.get(prefix + "DY", "").strip() if not day: return f"{year}-{int(month):02d}" return f"{year}-{int(month):02d}-{int(day):02d}"def parse_full_date(text): """Return a date for a complete ISO date string, else None.""" if len(text) != 10: return None try: year, month, day = (int(piece) for piece in text.split("-")) return date(year, month, day) except ValueError: return Nonedef study_day(date_text, ref_start): """SDTM study day of a complete date relative to the reference start. The reference start date itself is day 1; the day before it is day -1 (there is no day 0). Partial dates and missing reference dates have no study day. """ value = parse_full_date(date_text) if value is None or ref_start is None: return "" delta = (value - ref_start).days return str(delta + 1 if delta >= 0 else delta)def main(): dm_rows = read_csv(f"{INPUT_DIR}/dm.csv") ref_start_by_subject = {} for row in dm_rows: ref = parse_full_date((row.get("RFSTDTC") or "").strip()) ref_start_by_subject[row["USUBJID"]] = ref odm_rows = read_csv(f"{INPUT_DIR}/odm.csv") # Group the AE form items by subject and form repeat key (AESEQ), # keeping first-appearance order of subjects and events. events = {} order = [] for row in odm_rows: if row["FormOID"] != "FO.AE": continue key = (row["StudyOID"], row["SubjectKey"], row["FormRepeatKey"]) if key not in events: events[key] = {} order.append(key) item = row["ItemOID"].rsplit(".", 1)[-1] events[key][item] = row["Value"] out_rows = [] for study_oid, subject_key, repeat_key in order: items = events[(study_oid, subject_key, repeat_key)] start_dtc = assemble_date(items, "AEST") end_dtc = assemble_date(items, "AEEN") ref_start = ref_start_by_subject.get(subject_key) out_rows.append( { "DOMAIN": "AE", "STUDYID": study_oid, "USUBJID": subject_key, "AESEQ": repeat_key, "AETERM": items.get("AETERM", ""), "AESTDTC": start_dtc, "AEENDTC": end_dtc, "AESTDY": study_day(start_dtc, ref_start), "AEENDY": study_day(end_dtc, ref_start), } ) with open(OUTPUT_PATH, "w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=COLUMNS) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/sdtm-ae-partial-dates/result.sas
Edit48 lines/* opensas reference solution for the yamaa benchmark sdtm-ae-partial-dates. 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 RFSTDTC $1024; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. RFSTDTC : $char1024.;run;data odm; length StudyOID MetaDataVersionOID SubjectKey StudyEventOID StudyEventRepeatKey FormOID FormRepeatKey ItemGroupOID ItemGroupRepeatKey ItemOID Value $1024; infile "/app/input/odm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input StudyOID : $char1024. MetaDataVersionOID : $char1024. SubjectKey : $char1024. StudyEventOID : $char1024. StudyEventRepeatKey : $char1024. FormOID : $char1024. FormRepeatKey : $char1024. ItemGroupOID : $char1024. ItemGroupRepeatKey : $char1024. ItemOID : $char1024. Value : $char1024.;run;proc sort data=odm out=ordered; by StudyOID SubjectKey FormRepeatKey; run;data wide; length AETERM AESTYR AESTMO AEENYR AEENMO STARTDAY ENDDAY $1024; retain AETERM AESTYR AESTMO AEENYR AEENMO STARTDAY ENDDAY; set ordered; where ItemGroupOID='IG.AE'; by StudyOID SubjectKey FormRepeatKey; if first.FormRepeatKey then do; AETERM=''; AESTYR=''; AESTMO=''; AEENYR=''; AEENMO=''; STARTDAY=''; ENDDAY=''; end; if ItemOID='IT.AE.AETERM' then AETERM=Value; if ItemOID='IT.AE.AESTYR' then AESTYR=Value; if ItemOID='IT.AE.AESTMO' then AESTMO=Value; if ItemOID='IT.AE.AEENYR' then AEENYR=Value; if ItemOID='IT.AE.AEENMO' then AEENMO=Value; if ItemOID='IT.AE.AESTDY' then STARTDAY=Value; if ItemOID='IT.AE.AEENDY' then ENDDAY=Value; if last.FormRepeatKey then output;run;data dates; set wide; length DOMAIN $2 STUDYID USUBJID AESTDTC AEENDTC $1024;DOMAIN='AE'; STUDYID=StudyOID; USUBJID=SubjectKey; AESEQ=input(FormRepeatKey,best32.);AESTDTC=''; AEENDTC='';if not missing(AESTYR) then do; AESTDTC=AESTYR; if not missing(AESTMO) then do; AESTDTC=catx('-',AESTDTC,AESTMO); if not missing(STARTDAY) then AESTDTC=catx('-',AESTDTC,STARTDAY); end; end;if not missing(AEENYR) then do; AEENDTC=AEENYR; if not missing(AEENMO) then do; AEENDTC=catx('-',AEENDTC,AEENMO); if not missing(ENDDAY) then AEENDTC=catx('-',AEENDTC,ENDDAY); end; end; run;proc sql; create table joined as select a.*,b.RFSTDTC from dates a left join dm b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;data result; set joined; AESTDY=.; AEENDY=.; if lengthn(RFSTDTC)=10 then do;if lengthn(AESTDTC)=10 then do; AESTDY=input(AESTDTC,yymmdd10.)-input(RFSTDTC,yymmdd10.); if AESTDY>=0 then AESTDY+1; end;if lengthn(AEENDTC)=10 then do; AEENDY=input(AEENDTC,yymmdd10.)-input(RFSTDTC,yymmdd10.); if AEENDY>=0 then AEENDY+1; end; end; run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, AESEQ, AETERM, AESTDTC, AEENDTC, AESTDY, AEENDY from result;quit;proc export data=final outfile="/app/output/ae.csv" dbms=csv replace; run;
yamaa