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: create one FA record for each collected reaction finding from a long-form Operational Data Model (ODM) diary, while carrying the reported reaction name and date from the same diary occurrence.
Input: each diary occurrence contains a free-text reaction name and collection date as sibling items, plus separate occurrence, severity, and optional diameter items. One reaction can therefore produce several FA tests. A form repeat number can be reused on another diary day.
Variables:
FASEQnumbers the subject's findings by diary day, reaction repeat, and test order.FATESTCDandFATESTidentify occurrence, severity, or longest diameter from the collected result item.FAOBJis the reaction name exactly as reported in the sibling item.FACATisREACTOGENICITYfor every diary finding.FAORRESandFASTRESCkeep the collected result;FAORRESUismmfor diameter only.FASTATisNOT DONEfor a result item that is present but blank, and blank for reported results.FATPTidentifies the diary day, andFADTCis its collection date.
Note: a reaction without a severity or diameter item produces no such FA test, while a present item with a blank result still produces its FA record.
Inputs
Under review1 source fileinput/odm.csv
Edit18 rows| StudyOID | MetaDataVersionOID | SubjectKey | StudyEventOID | StudyEventRepeatKey | ItemGroupOID | ItemGroupRepeatKey | ItemOID | Value |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.DM | 1 | IT.DM.SEX | F |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 1 | IT.FA.FAOBJ | Injection site redness |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 1 | IT.FA.FADTC | 2025-01-01 |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 1 | IT.FA.OCCUR | Y |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 1 | IT.FA.SEV | MODERATE |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 1 | IT.FA.LDIAM | 25 |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 2 | IT.FA.FAOBJ | Fatigue |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 2 | IT.FA.FADTC | 2025-01-01 |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY1 | 1 | IG.FA | 2 | IT.FA.OCCUR | N |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY2 | 1 | IG.FA | 1 | IT.FA.FAOBJ | Injection site redness |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY2 | 1 | IG.FA | 1 | IT.FA.FADTC | 2025-01-02 |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY2 | 1 | IG.FA | 1 | IT.FA.OCCUR | Y |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY2 | 1 | IG.FA | 1 | IT.FA.SEV | — |
| YAMAA-01 | MDV.1 | YAMAA-01-0001 | DAY2 | 1 | IG.FA | 1 | IT.FA.LDIAM | 10 |
| YAMAA-01 | MDV.1 | YAMAA-01-0002 | DAY1 | 1 | IG.FA | 1 | IT.FA.FAOBJ | Fatigue |
| YAMAA-01 | MDV.1 | YAMAA-01-0002 | DAY1 | 1 | IG.FA | 1 | IT.FA.FADTC | 2025-02-01 |
| YAMAA-01 | MDV.1 | YAMAA-01-0002 | DAY1 | 1 | IG.FA | 1 | IT.FA.OCCUR | Y |
| YAMAA-01 | MDV.1 | YAMAA-01-0002 | DAY1 | 1 | IG.FA | 1 | IT.FA.SEV | MILD |
Expected output
Under review9 expected rowsexpected/fa.csv
Edit9 rows| DOMAIN | STUDYID | USUBJID | FASEQ | FATESTCD | FATEST | FAOBJ | FACAT | FAORRES | FAORRESU | FASTRESC | FASTAT | FATPT | FADTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| FA | YAMAA-01 | 1 | OCCUR | Occurrence Indicator | Injection site redness | REACTOGENICITY | Y | — | Y | — | END DAY 1 | 2025-01-01 | |
| FA | YAMAA-01 | 2 | SEV | Severity/Intensity | Injection site redness | REACTOGENICITY | MODERATE | — | MODERATE | — | END DAY 1 | 2025-01-01 | |
| FA | YAMAA-01 | 3 | LDIAM | Longest Diameter | Injection site redness | REACTOGENICITY | 25 | mm | 25 | — | END DAY 1 | 2025-01-01 | |
| FA | YAMAA-01 | 4 | OCCUR | Occurrence Indicator | Fatigue | REACTOGENICITY | N | — | N | — | END DAY 1 | 2025-01-01 | |
| FA | YAMAA-01 | 5 | OCCUR | Occurrence Indicator | Injection site redness | REACTOGENICITY | Y | — | Y | — | END DAY 2 | 2025-01-02 | |
| FA | YAMAA-01 | 6 | SEV | Severity/Intensity | Injection site redness | REACTOGENICITY | — | — | — | NOT DONE | END DAY 2 | 2025-01-02 | |
| FA | YAMAA-01 | 7 | LDIAM | Longest Diameter | Injection site redness | REACTOGENICITY | 10 | mm | 10 | — | END DAY 2 | 2025-01-02 | |
| FA | YAMAA-01 | 1 | OCCUR | Occurrence Indicator | Fatigue | REACTOGENICITY | Y | — | Y | — | END DAY 1 | 2025-02-01 | |
| FA | YAMAA-01 | 2 | SEV | Severity/Intensity | Fatigue | REACTOGENICITY | MILD | — | MILD | — | END DAY 1 | 2025-02-01 |
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 "FA". | 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 | ||||
| FATESTCD | Findings About Test Short Name | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 4 | ||||
| FATEST | Findings About Test Name | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 5 | ||||
| FAOBJ | Object of the Observation | Char | Derived | Take Value from the ODM_SIBLING record whose StudyOID equals ODM.StudyOID, SubjectKey equals ODM.SubjectKey, StudyEventOID equals ODM.StudyEventOID, StudyEventRepeatKey equals ODM.StudyEventRepeatKey, ItemGroupOID equals ODM.ItemGroupOID and ItemGroupRepeatKey equals ODM.ItemGroupRepeatKey, where ODM_SIBLING.ItemOID = 'IT.FA.FAOBJ', and a row with no match is an error. | SDTM | 6 | ||||
| FACAT | Category for Findings About | Char | Assigned | Set constant value "REACTOGENICITY". | SDTM | 7 | ||||
| FAORRES | Result or Finding in Original Units | Char | Collected | Copy value from ODM.Value. | SDTM | 8 | ||||
| FAORRESU | Original Units | Char | Derived | If FATESTCD = 'LDIAM' then "mm"; otherwise blank. | SDTM | 9 | ||||
| FASTRESC | Character Result/Finding in Std Format | Char | Derived | Copy value from FAORRES. | SDTM | 10 | ||||
| FASTAT | Completion Status | Char | Derived | If FAORRES IS NULL then "NOT DONE"; otherwise blank. | SDTM | 11 | ||||
| FATPT | Planned Time Point Name | Char | Collected | Recode ODM.StudyEventOID: "DAY1" → "END DAY 1", "DAY2" → "END DAY 2"; missing values stay missing; unlisted values are errors. | SDTM | 12 | ||||
| FADTC | Date/Time of Collection | Char | Derived | Take Value from the ODM_SIBLING record whose StudyOID equals ODM.StudyOID, SubjectKey equals ODM.SubjectKey, StudyEventOID equals ODM.StudyEventOID, StudyEventRepeatKey equals ODM.StudyEventRepeatKey, ItemGroupOID equals ODM.ItemGroupOID and ItemGroupRepeatKey equals ODM.ItemGroupRepeatKey, where ODM_SIBLING.ItemOID = 'IT.FA.FADTC', and a row with no match is an error. | SDTM | 13 | ||||
| FASEQ | Sequence Number | Num | Derived | Row number within each group of STUDYID, USUBJID, ordered by EVENTORD then EVENTREPEAT then REPEATKEY then TESTORD. | SDTM | 14 |
| Template | Include when | FATESTCD | FATEST | TESTORD |
|---|---|---|---|---|
| reported-finding | ODM.ItemGroupOID = 'IG.FA' AND ODM.ItemOID IN ('IT.FA.OCCUR', 'IT.FA.SEV', 'IT.FA.LDIAM') | Recode ODM.ItemOID: "IT.FA.OCCUR" → "OCCUR", "IT.FA.SEV" → "SEV", "IT.FA.LDIAM" → "LDIAM"; missing or unlisted values → "UNMAPPED" | Recode ODM.ItemOID: "IT.FA.OCCUR" → "Occurrence Indicator", "IT.FA.SEV" → "Severity/Intensity", "IT.FA.LDIAM" → "Longest Diameter"; missing or unlisted values → "Unmapped" | Recode ODM.ItemOID: "IT.FA.OCCUR" → "1", "IT.FA.SEV" → "2", "IT.FA.LDIAM" → "3"; missing or unlisted values → "99" |
| 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-fa-odm-multitest/full.md
Edit30 linesFollowing CDISC SDTM standards, use the provided ODM dataset to create an FA dataset with one record per collected reaction finding.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, FASEQ, FATESTCD, FATEST, FAOBJ, FACAT, FAORRES, FAORRESU, FASTRESC, FASTAT, FATPT, FADTC
DOMAIN is "FA". STUDYID is the ODM study OID and USUBJID is the ODM subject key, each as given. One record is written for each occurrence, severity, or longest diameter result item collected for a reaction. A reaction with no severity or diameter item has no such record, while a result item that is present with a blank result still gives its record. FATESTCD is "OCCUR" for the occurrence result, "SEV" for the severity result, and "LDIAM" for the longest diameter result, and FATEST is "Occurrence Indicator", "Severity/Intensity", and "Longest Diameter" for the same results. FAOBJ is the reaction name exactly as reported in the reaction name item of the same diary occurrence. FACAT is "REACTOGENICITY" for every record. FAORRES is the result as collected, and FASTRESC holds the same result. FAORRESU is "mm" on a longest diameter record and has no value on an occurrence or severity record. FASTAT is "NOT DONE" when a result item is present but its result is blank, and has no value when a result is reported. FATPT is "END DAY 1" for diary day DAY1 and "END DAY 2" for diary day DAY2. FADTC is the collection date collected for the same diary occurrence. FASEQ numbers a subject's records from 1 by diary day, then by the diary day's repeat, then by reaction repeat, then by test order, occurrence first, then severity, then longest diameter.
Read the source datasets from /app/input and save the completed dataset as /app/output/fa.csv.
prompts/sdtm-fa-odm-multitest/conventions.md
Edit15 linesFollowing CDISC SDTM standards, use the provided ODM dataset to create an FA dataset with one record per collected reaction finding.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, FASEQ, FATESTCD, FATEST, FAOBJ, FACAT, FAORRES, FAORRESU, FASTRESC, FASTAT, FATPT, FADTC
DOMAIN is "FA". FATESTCD is "OCCUR", "SEV", or "LDIAM", and FATEST is "Occurrence Indicator", "Severity/Intensity", and "Longest Diameter". FACAT is "REACTOGENICITY" for every record. FASTAT is "NOT DONE" or has no value. FATPT is "END DAY 1" for diary day DAY1 and "END DAY 2" for diary day DAY2.
Read the source datasets from /app/input and save the completed dataset as /app/output/fa.csv.
prompts/sdtm-fa-odm-multitest/brief.md
Edit9 linesFollowing CDISC SDTM standards, use the provided ODM dataset to create an FA dataset with one record per collected reaction finding.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, FASEQ, FATESTCD, FATEST, FAOBJ, FACAT, FAORRES, FAORRESU, FASTRESC, FASTAT, FATPT, FADTC
Read the source datasets from /app/input and save the completed dataset as /app/output/fa.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-fa-odm-multitest/result.R
Edit93 lines# Reference solution for the yamaa benchmark sdtm-fa-odm-multitest (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(purrr)odm <- read_csv( "/app/input/odm.csv", col_types = cols(.default = col_character())) |> mutate(Value = na_if(Value, ""))forms <- odm |> filter(ItemGroupOID == "IG.FA") |> distinct( StudyOID, SubjectKey, StudyEventOID, StudyEventRepeatKey, ItemGroupRepeatKey )one_form <- function(study, subj, event, rep, igrep) { sub <- odm |> filter( SubjectKey == subj, StudyEventOID == event, StudyEventRepeatKey == rep, ItemGroupOID == "IG.FA", ItemGroupRepeatKey == igrep ) present <- sub$ItemOID get <- function(oid) { hit <- sub |> filter(ItemOID == oid) if (nrow(hit) == 0) return(list(present = FALSE, value = NA_character_)) list(present = TRUE, value = hit$Value[[1]]) } obj <- get("IT.FA.FAOBJ") if (!obj$present || is.na(obj$value)) return(tibble()) fadtc <- get("IT.FA.FADTC")$value day <- dplyr::recode(event, DAY1 = 1L, DAY2 = 2L, .default = 99L) fatpt <- dplyr::recode( event, DAY1 = "END DAY 1", DAY2 = "END DAY 2", .default = NA_character_ ) specs <- list( list(oid = "IT.FA.OCCUR", code = "OCCUR", name = "Occurrence Indicator"), list(oid = "IT.FA.SEV", code = "SEV", name = "Severity/Intensity"), list(oid = "IT.FA.LDIAM", code = "LDIAM", name = "Longest Diameter") ) imap_dfr(specs, function(spec, i) { g <- get(spec$oid) if (!g$present) return(tibble()) blank <- is.na(g$value) tibble( DOMAIN = "FA", STUDYID = study, USUBJID = subj, DAY = day, REP = as.integer(igrep), ORDER = as.integer(i - 1L), FATESTCD = spec$code, FATEST = spec$name, FAOBJ = obj$value, FACAT = "REACTOGENICITY", FAORRES = g$value, FAORRESU = if_else(spec$oid == "IT.FA.LDIAM", "mm", NA_character_), FASTRESC = g$value, FASTAT = if_else(blank, "NOT DONE", NA_character_), FATPT = fatpt, FADTC = fadtc ) })}fa <- pmap_dfr( list( forms$StudyOID, forms$SubjectKey, forms$StudyEventOID, forms$StudyEventRepeatKey, forms$ItemGroupRepeatKey ), one_form) |> arrange(STUDYID, USUBJID, DAY, REP, ORDER) |> group_by(STUDYID, USUBJID) |> mutate(FASEQ = row_number()) |> ungroup() |> select( DOMAIN, STUDYID, USUBJID, FASEQ, FATESTCD, FATEST, FAOBJ, FACAT, FAORRES, FAORRESU, FASTRESC, FASTAT, FATPT, FADTC )dir.create("/app/output", showWarnings = FALSE)write_csv(fa, "/app/output/fa.csv", na = "")solutions/sdtm-fa-odm-multitest/result.py
Edit113 lines# Reference solution for the yamaa benchmark sdtm-fa-odm-multitest (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 FA (Findings About) dataset from the ODM extract.One record per collected reaction finding: for each diary occurrence(an IG.FA item group repeat within a study event), one record for eachof the occurrence, severity, and longest diameter result items that wascollected. A result item present with a blank result still gives itsrecord, flagged FASTAT = "NOT DONE"."""import csvimport reINPUT_ODM = "/app/input/odm.csv"OUTPUT_FA = "/app/output/fa.csv"COLUMNS = [ "DOMAIN", "STUDYID", "USUBJID", "FASEQ", "FATESTCD", "FATEST", "FAOBJ", "FACAT", "FAORRES", "FAORRESU", "FASTRESC", "FASTAT", "FATPT", "FADTC",]# Result items in test order: (item OID suffix, FATESTCD, FATEST).TESTS = [ ("OCCUR", "OCCUR", "Occurrence Indicator"), ("SEV", "SEV", "Severity/Intensity"), ("LDIAM", "LDIAM", "Longest Diameter"),]def day_number(study_event_oid): """Numeric part of a diary day OID such as DAY1 or DAY2.""" match = re.search(r"(\d+)\s*$", study_event_oid) return int(match.group(1)) if match else 0def main(): with open(INPUT_ODM, newline="", encoding="utf-8") as handle: rows = list(csv.DictReader(handle)) # Group the IG.FA items by diary occurrence: subject, study event # (diary day) and its repeat, and the item group (reaction) repeat. occurrences = {} subject_order = [] for row in rows: if row["ItemGroupOID"] != "IG.FA": continue key = ( row["SubjectKey"], row["StudyEventOID"], row["StudyEventRepeatKey"], row["ItemGroupRepeatKey"], ) if key not in occurrences: occurrences[key] = {"study": row["StudyOID"], "items": {}} if row["SubjectKey"] not in subject_order: subject_order.append(row["SubjectKey"]) item = row["ItemOID"].rsplit(".", 1)[-1] occurrences[key]["items"][item] = row["Value"] records_by_subject = {} for (subject, event_oid, event_repeat, group_repeat), occ in occurrences.items(): items = occ["items"] reaction = items.get("FAOBJ", "") fadtc = items.get("FADTC", "") day = day_number(event_oid) fatpt = "END DAY %d" % day for test_index, (item_key, testcd, test) in enumerate(TESTS): if item_key not in items: # The result item was not collected for this reaction: # no record. continue result = items[item_key] record = { "DOMAIN": "FA", "STUDYID": occ["study"], "USUBJID": subject, "FATESTCD": testcd, "FATEST": test, "FAOBJ": reaction, "FACAT": "REACTOGENICITY", "FAORRES": result, "FAORRESU": "mm" if testcd == "LDIAM" else "", "FASTRESC": result, "FASTAT": "NOT DONE" if result == "" else "", "FATPT": fatpt, "FADTC": fadtc, } sort_key = (day, int(event_repeat), int(group_repeat), test_index) records_by_subject.setdefault(subject, []).append((sort_key, record)) out_rows = [] for subject in subject_order: subject_records = sorted( records_by_subject.get(subject, []), key=lambda pair: pair[0] ) for seq, (_, record) in enumerate(subject_records, start=1): record["FASEQ"] = str(seq) out_rows.append(record) with open(OUTPUT_FA, "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-fa-odm-multitest/result.sas
Edit42 lines/* opensas reference solution for the yamaa benchmark sdtm-fa-odm-multitest. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data odm; length StudyOID MetaDataVersionOID SubjectKey StudyEventOID StudyEventRepeatKey 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. ItemGroupOID : $char1024. ItemGroupRepeatKey : $char1024. ItemOID : $char1024. Value : $char1024.;run;proc sort data=odm out=ordered; by StudyOID SubjectKey StudyEventOID StudyEventRepeatKey ItemGroupRepeatKey; run;data siblings; length FAOBJ FADTC $1024; retain FAOBJ FADTC; set ordered; where ItemGroupOID='IG.FA'; by StudyOID SubjectKey StudyEventOID StudyEventRepeatKey ItemGroupRepeatKey; if first.ItemGroupRepeatKey then do; FAOBJ=''; FADTC=''; end; if ItemOID='IT.FA.FAOBJ' then FAOBJ=Value; if ItemOID='IT.FA.FADTC' then FADTC=Value; if last.ItemGroupRepeatKey then output;run;proc sql;create table joined as select a.*,b.FAOBJ,b.FADTC from odm a inner join siblings b on a.StudyOID=b.StudyOID and a.SubjectKey=b.SubjectKey and a.StudyEventOID=b.StudyEventOID and a.StudyEventRepeatKey=b.StudyEventRepeatKey and a.ItemGroupRepeatKey=b.ItemGroupRepeatKey where a.ItemOID in ('IT.FA.OCCUR','IT.FA.SEV','IT.FA.LDIAM'); quit;data prepared; set joined; length DOMAIN $2 STUDYID USUBJID FATESTCD FATEST FACAT FAORRES FAORRESU FASTRESC FASTAT FATPT $1024;DOMAIN='FA'; STUDYID=StudyOID; USUBJID=SubjectKey; FACAT='REACTOGENICITY'; FAORRES=Value; FASTRESC=Value; FAORRESU=''; FASTAT=''; if missing(Value) then FASTAT='NOT DONE';if ItemOID='IT.FA.OCCUR' then do; FATESTCD='OCCUR'; FATEST='Occurrence Indicator'; TESTORD=1; end;if ItemOID='IT.FA.SEV' then do; FATESTCD='SEV'; FATEST='Severity/Intensity'; TESTORD=2; end;if ItemOID='IT.FA.LDIAM' then do; FATESTCD='LDIAM'; FATEST='Longest Diameter'; FAORRESU='mm'; TESTORD=3; end;FATPT='END DAY 1'; if StudyEventOID='DAY2' then FATPT='END DAY 2'; DAYORD=input(compress(StudyEventOID,,'kd'),best32.); REP=input(ItemGroupRepeatKey,best32.); run;proc sort data=prepared; by STUDYID USUBJID DAYORD REP TESTORD; run;data result; set prepared; by STUDYID USUBJID; retain FASEQ; if first.USUBJID then FASEQ=0; FASEQ+1;run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, FASEQ, FATESTCD, FATEST, FAOBJ, FACAT, FAORRES, FAORRESU, FASTRESC, FASTAT, FATPT, FADTC from result;quit;proc export data=final outfile="/app/output/fa.csv" dbms=csv replace; run;
yamaa