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 SDTM: 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: build one Procedures (PR) record from each of two
prior-procedure forms carried in a single ODM item extract:
a prior cancer surgery form and a prior radiotherapy form.
PRTRT keeps the reported procedure name, PRCAT names the
form, PRLOC/PRLAT carry the surgery site, and the
radiotherapy record carries its dose in PRDOSE/PRDOSU.
PRSTDTC/PRENDTC keep the precision collected, so a
year-month surgery date stays 2023-11. The pre-specified
question "Any prior radiotherapy?" always writes a record:
PRPRESP is Y, and PROCCUR is Y or N.
Input: one ODM file (input/odm.csv) with one row per
collected item value, keyed by study, subject, study event,
form and item. Subject 001 reports a lumpectomy with only a
year-month date and a radiotherapy course of 50 Gy from
2024-02-10 to 2024-03-20. Subject 002 answers "No" to prior
radiotherapy, so only the question and its answer are
collected for that subject.
Variables:
PRSEQnumbers each subject's records byPRSTDTCand then byPRTRT; withSTUDYIDandUSUBJIDit identifies the record.PRCATnames the form:PRIOR CANCER SURGERYorPRIOR RADIOTHERAPY.PRPRESPisYfor the pre-specified radiotherapy question and blank for the reported surgery.PROCCURisYorNfor the pre-specified question and blank for the reported surgery.PRLOCandPRLATcarry the surgery site; they are blank for radiotherapy.PRDOSEandPRDOSUcarry the radiotherapy dose; they are blank when the procedure did not occur and for surgery.PRSTDTCandPRENDTCkeep the collected precision: the lumpectomy date stays2023-11, while the radiotherapy course carries full start and end dates.
Note: a "No" answer is still a record. It lets the study tell "no prior radiotherapy" apart from "never asked", and it carries no dose and no dates.
Provenance: PRPRESP/PROCCUR follow the SDTMIG
pre-specified pattern (an asked question with an occurrence
flag). All subjects, procedures and dates are invented
fixtures.
Inputs
Under review1 source fileinput/odm.csv
Edit12 rows| StudyOID | MetaDataVersionOID | SubjectKey | StudyEventOID | StudyEventRepeatKey | ItemGroupOID | ItemGroupRepeatKey | ItemOID | Value |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.SURGERY | 1 | IT.PR.PRTRT | LUMPECTOMY |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.SURGERY | 1 | IT.PR.PRLOC | BREAST |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.SURGERY | 1 | IT.PR.PRLAT | LEFT |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.SURGERY | 1 | IT.PR.PRSTDTC | 2023-11 |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.RTPRSP | Y |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.PRTRT | RADIOTHERAPY |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.PRDOSE | 50 |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.PRDOSU | Gy |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.PRSTDTC | 2024-02-10 |
| YAMAA-01 | MDV.1 | 001 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.PRENDTC | 2024-03-20 |
| YAMAA-01 | MDV.1 | 002 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.RTPRSP | N |
| YAMAA-01 | MDV.1 | 002 | SCREENING | 1 | IG.PR.RADIOTHERAPY | 1 | IT.PR.PRTRT | RADIOTHERAPY |
Expected output
Under review3 expected rowsexpected/pr.csv
Edit3 rows| DOMAIN | STUDYID | USUBJID | PRSEQ | PRTRT | PRCAT | PRPRESP | PROCCUR | PRLOC | PRLAT | PRDOSE | PRDOSU | PRSTDTC | PRENDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PR | YAMAA-01 | 1 | LUMPECTOMY | PRIOR CANCER SURGERY | — | — | BREAST | LEFT | — | — | 2023-11 | — | |
| PR | YAMAA-01 | 2 | RADIOTHERAPY | PRIOR RADIOTHERAPY | Y | Y | — | — | 50 | Gy | 2024-02-10 | 2024-03-20 | |
| PR | YAMAA-01 | 1 | RADIOTHERAPY | PRIOR RADIOTHERAPY | Y | N | — | — | — | — | — | — |
Comments and assessment materials
| 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 | PR | Assigned | Set constant value "PR". | SDTM | 1 | |||
| STUDYID | Study Identifier | Char | Collected | Copy value from ODM.StudyOID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Derived | Fill the template "{STUDYID}-{SUBJKEY}". | SDTM | 3 | ||||
| PRTRT | Reported Name of the Procedure | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 4 | ||||
| PRCAT | Category for Procedures | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 5 | ||||
| PRPRESP | Pre-Specified Procedure Indicator | Char | Y | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 6 | |||
| PROCCUR | Procedure Occurrence | Char | Y, N | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 7 | |||
| PRLOC | Location of Procedure | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 8 | ||||
| PRLAT | Laterality | Char | LEFT, RIGHT, BILATERAL, UNILATERAL | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 9 | |||
| PRDOSE | Dose per Administration | Num | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 10 | ||||
| PRDOSU | Dose Units | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 11 | ||||
| PRSTDTC | Start Date/Time of Procedure | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 12 | ||||
| PRENDTC | End Date/Time of Procedure | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 13 | ||||
| PRSEQ | Sequence Number | Num | Derived | Row number within each group of STUDYID, USUBJID, ordered by PRSTDTC then PRTRT. | SDTM | 14 |
| Template | Include when | FORM | PRTRT | PRCAT | ANSWER | PRPRESP | PROCCUR | PRLOC | PRLAT | PRDOSE | PRDOSU | PRSTDTC | PRENDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| surgery | FORM = 'IG.PR.SURGERY' | Copy ODM.ItemGroupOID | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRTRT' | Constant "PRIOR CANCER SURGERY" | Constant "None" | Constant "None" | Constant "None" | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRLOC' | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRLAT' | Constant "None" | Constant "None" | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRSTDTC' | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRENDTC' |
| radiotherapy | FORM = 'IG.PR.RADIOTHERAPY' | Copy ODM.ItemGroupOID | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRTRT' | Constant "PRIOR RADIOTHERAPY" | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.RTPRSP' | Constant "Y" | If ANSWER = 'Y' then "Y"; If ANSWER = 'N' then "N"; otherwise "None" | Constant "None" | Constant "None" | If PROCCUR = 'Y' then aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRDOSE'; otherwise "None" | If PROCCUR = 'Y' then aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRDOSU'; otherwise "None" | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRSTDTC' | Aggregate ONLY(ODM.Value) over records matching on the shared output keys, where ODM.ItemOID = 'IT.PR.PRENDTC' |
| Variable | Permitted values |
|---|---|
| DOMAIN | PR |
| PRPRESP | Y |
| PROCCUR | Y, N |
| PRLAT | LEFT, RIGHT, BILATERAL, UNILATERAL |
| 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/sdtm-pr-procedures/full.md
Edit28 linesFollowing CDISC SDTM standards, use the provided ODM dataset to create a PR dataset with one record per reported procedure and per answer to the pre-specified radiotherapy question.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PRSEQ, PRTRT, PRCAT, PRPRESP, PROCCUR, PRLOC, PRLAT, PRDOSE, PRDOSU, PRSTDTC, PRENDTC
STUDYID is the ODM StudyOID. USUBJID is the study and subject identifiers with a hyphen between them.
PRSEQ numbers each subject's records by PRSTDTC and then by PRTRT. PRTRT is the reported procedure name. PRCAT names the form: PRIOR CANCER SURGERY or PRIOR RADIOTHERAPY. PRPRESP is Y for the pre-specified radiotherapy question and has no value for the reported surgery. PROCCUR is Y or N for the pre-specified question and has no value for the reported surgery. PRLOC and PRLAT carry the surgery site, and have no value for radiotherapy. PRDOSE and PRDOSU carry the radiotherapy dose, and have no value when the procedure did not occur and for surgery. PRSTDTC and PRENDTC keep the collected precision: a year-month surgery date stays year-month, while the radiotherapy course carries full start and end dates.
A "No" answer is still a record, with no dose and no dates: it tells "no prior radiotherapy" apart from "never asked".
Read the source datasets from /app/input and save the completed dataset as /app/output/pr.csv.
prompts/sdtm-pr-procedures/conventions.md
Edit13 linesFollowing CDISC SDTM standards, use the provided ODM dataset to create a PR dataset with one record per reported procedure and per answer to the pre-specified radiotherapy question.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PRSEQ, PRTRT, PRCAT, PRPRESP, PROCCUR, PRLOC, PRLAT, PRDOSE, PRDOSU, PRSTDTC, PRENDTC
PRCAT names the form: PRIOR CANCER SURGERY or PRIOR RADIOTHERAPY. PRPRESP is Y or has no value. PROCCUR is Y or N, or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/pr.csv.
prompts/sdtm-pr-procedures/brief.md
Edit10 linesFollowing CDISC SDTM standards, use the provided ODM dataset to create a PR dataset with one record per reported procedure and per answer to the pre-specified radiotherapy question.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PRSEQ, PRTRT, PRCAT, PRPRESP, PROCCUR, PRLOC, PRLAT, PRDOSE, PRDOSU, PRSTDTC, PRENDTC
Read the source datasets from /app/input and save the completed dataset as /app/output/pr.csv.
run.R
Edit4 lineslibrary(yamaa)pr <- yamaa_domain("spec.yaml")$outputprrun.py
Edit4 linesimport yamaapr = yamaa.yamaa_domain("spec.yaml").outputprsolutions/sdtm-pr-procedures/result.R
Edit74 lines# Reference solution for the yamaa benchmark sdtm-pr-procedures (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)odm <- read_csv( "/app/input/odm.csv", col_types = cols(.default = col_character()))wide <- odm |> mutate(Value = na_if(Value, "")) |> pivot_wider( id_cols = c(StudyOID, SubjectKey, StudyEventOID, ItemGroupOID, ItemGroupRepeatKey), names_from = ItemOID, values_from = Value, values_fn = function(x) x[[1]] )pr <- wide |> mutate( STUDYID = StudyOID, # USUBJID carries the study prefix when the ODM subject key does not. USUBJID = if_else( startsWith(SubjectKey, paste0(StudyOID, "-")), SubjectKey, paste0(StudyOID, "-", SubjectKey) ), DOMAIN = "PR", PRTRT = IT.PR.PRTRT, PRCAT = case_when( ItemGroupOID == "IG.PR.SURGERY" ~ "PRIOR CANCER SURGERY", ItemGroupOID == "IG.PR.RADIOTHERAPY" ~ "PRIOR RADIOTHERAPY" ), PRPRESP = if_else(ItemGroupOID == "IG.PR.RADIOTHERAPY", "Y", NA_character_), PROCCUR = if_else( ItemGroupOID == "IG.PR.RADIOTHERAPY", IT.PR.RTPRSP, NA_character_ ), PRLOC = if_else(ItemGroupOID == "IG.PR.SURGERY", IT.PR.PRLOC, NA_character_), PRLAT = if_else(ItemGroupOID == "IG.PR.SURGERY", IT.PR.PRLAT, NA_character_), PRDOSE = if_else( ItemGroupOID == "IG.PR.RADIOTHERAPY" & PROCCUR == "Y", IT.PR.PRDOSE, NA_character_ ), PRDOSU = if_else( ItemGroupOID == "IG.PR.RADIOTHERAPY" & PROCCUR == "Y", IT.PR.PRDOSU, NA_character_ ), PRSTDTC = case_when( ItemGroupOID == "IG.PR.RADIOTHERAPY" & PROCCUR == "Y" ~ IT.PR.PRSTDTC, ItemGroupOID == "IG.PR.SURGERY" ~ IT.PR.PRSTDTC, TRUE ~ NA_character_ ), PRENDTC = if_else( ItemGroupOID == "IG.PR.RADIOTHERAPY" & PROCCUR == "Y", IT.PR.PRENDTC, NA_character_ ) ) |> arrange(USUBJID, is.na(PRSTDTC), PRSTDTC, PRTRT) |> group_by(USUBJID) |> mutate(PRSEQ = row_number()) |> ungroup() |> arrange(USUBJID, PRSEQ) |> select( DOMAIN, STUDYID, USUBJID, PRSEQ, PRTRT, PRCAT, PRPRESP, PROCCUR, PRLOC, PRLAT, PRDOSE, PRDOSU, PRSTDTC, PRENDTC )dir.create("/app/output", showWarnings = FALSE)write_csv(pr, "/app/output/pr.csv", na = "")solutions/sdtm-pr-procedures/result.py
Edit121 lines# Reference solution for the yamaa benchmark sdtm-pr-procedures (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 pldef _present(value) -> bool: return value is not None and str(value) != ""odm = pl.read_csv("/app/input/odm.csv", infer_schema=False)# One record per reported procedure and per answer to the pre-specified# radiotherapy question: each form occurrence is a record.groups: dict[tuple, dict] = {}for row in odm.to_dicts(): key = ( str(row["StudyOID"]), str(row["SubjectKey"]), str(row["StudyEventOID"]), str(row["ItemGroupOID"]), str(row["ItemGroupRepeatKey"]), ) groups.setdefault(key, {})[str(row["ItemOID"])] = row["Value"]cat_by_group = { "IG.PR.SURGERY": "PRIOR CANCER SURGERY", "IG.PR.RADIOTHERAPY": "PRIOR RADIOTHERAPY",}rows = []for (studyid, subjkey, _event, group_oid, _rep), values in groups.items(): # USUBJID carries the study prefix when the ODM subject key does not. usubjid = subjkey if subjkey.startswith(studyid + "-") else f"{studyid}-{subjkey}" is_radio = group_oid == "IG.PR.RADIOTHERAPY" occurs = str(values.get("IT.PR.RTPRSP") or "") if is_radio else "" prtrt = str(values.get("IT.PR.PRTRT") or "") if is_radio: prpresp, procur = "Y", occurs if _present(occurs) else None else: prpresp, procur = None, None # Dose only when the procedure occurred; a "No" keeps no dose or dates. if is_radio and procur == "Y": dose = str(values.get("IT.PR.PRDOSE") or "") dose = dose if _present(dose) else None dosu = str(values.get("IT.PR.PRDOSU") or "") dosu = dosu if _present(dosu) else None stdtc = str(values.get("IT.PR.PRSTDTC") or "") stdtc = stdtc if _present(stdtc) else None endtc = str(values.get("IT.PR.PRENDTC") or "") endtc = endtc if _present(endtc) else None elif not is_radio: dose = dosu = None stdtc = str(values.get("IT.PR.PRSTDTC") or "") stdtc = stdtc if _present(stdtc) else None endtc = None # Surgery has no end date in the form. if "IT.PR.PRENDTC" in values and _present(values.get("IT.PR.PRENDTC")): endtc = str(values.get("IT.PR.PRENDTC")) else: dose = dosu = stdtc = endtc = None rows.append( { "DOMAIN": "PR", "STUDYID": studyid, "USUBJID": usubjid, "PRTRT": prtrt, "PRCAT": cat_by_group[group_oid], "PRPRESP": prpresp, "PROCCUR": procur, "PRLOC": str(values.get("IT.PR.PRLOC") or "") or None, "PRLAT": str(values.get("IT.PR.PRLAT") or "") or None, "PRDOSE": dose, "PRDOSU": dosu, "PRSTDTC": stdtc, "PRENDTC": endtc, } )# PRSEQ numbers each subject's records by start date, then procedure name.rows.sort(key=lambda r: (r["USUBJID"], r["PRSTDTC"] is None, r["PRSTDTC"] or "", r["PRTRT"]))seq_by_subject: dict[str, int] = {}for row in rows: seq_by_subject[row["USUBJID"]] = seq_by_subject.get(row["USUBJID"], 0) + 1 row["PRSEQ"] = str(seq_by_subject[row["USUBJID"]])pr = ( pl.DataFrame( rows, schema={ "DOMAIN": pl.String, "STUDYID": pl.String, "USUBJID": pl.String, "PRSEQ": pl.String, "PRTRT": pl.String, "PRCAT": pl.String, "PRPRESP": pl.String, "PROCCUR": pl.String, "PRLOC": pl.String, "PRLAT": pl.String, "PRDOSE": pl.String, "PRDOSU": pl.String, "PRSTDTC": pl.String, "PRENDTC": pl.String, }, ) .with_columns(pl.col("PRSEQ").cast(pl.Int64).alias("_seq")) .sort(["USUBJID", "_seq"]) .select( "DOMAIN", "STUDYID", "USUBJID", "PRSEQ", "PRTRT", "PRCAT", "PRPRESP", "PROCCUR", "PRLOC", "PRLAT", "PRDOSE", "PRDOSU", "PRSTDTC", "PRENDTC", ))Path("/app/output").mkdir(exist_ok=True)pr.write_csv("/app/output/pr.csv")solutions/sdtm-pr-procedures/result.sas
Edit44 lines/* opensas reference solution for the yamaa benchmark sdtm-pr-procedures. 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 ItemGroupOID ItemGroupRepeatKey; run;data wide; length PRTRT PRLOC PRLAT PRDOSU PRSTDTC PRENDTC RTPRSP DOSETEXT $1024; retain PRTRT PRLOC PRLAT PRDOSU PRSTDTC PRENDTC RTPRSP DOSETEXT; set ordered; by StudyOID SubjectKey ItemGroupOID ItemGroupRepeatKey; if first.ItemGroupRepeatKey then do; PRTRT=''; PRLOC=''; PRLAT=''; PRDOSU=''; PRSTDTC=''; PRENDTC=''; RTPRSP=''; DOSETEXT=''; end; if ItemOID='IT.PR.PRTRT' then PRTRT=Value; if ItemOID='IT.PR.PRLOC' then PRLOC=Value; if ItemOID='IT.PR.PRLAT' then PRLAT=Value; if ItemOID='IT.PR.PRDOSU' then PRDOSU=Value; if ItemOID='IT.PR.PRSTDTC' then PRSTDTC=Value; if ItemOID='IT.PR.PRENDTC' then PRENDTC=Value; if ItemOID='IT.PR.RTPRSP' then RTPRSP=Value; if ItemOID='IT.PR.PRDOSE' then DOSETEXT=Value; if last.ItemGroupRepeatKey then output;run;data prepared; set wide; length DOMAIN $2 STUDYID USUBJID PRCAT PRPRESP PROCCUR $1024;DOMAIN='PR'; STUDYID=StudyOID; USUBJID=catx('-',StudyOID,SubjectKey); PRPRESP=''; PROCCUR=''; PRDOSE=.;if ItemGroupOID='IG.PR.SURGERY' then do; PRCAT='PRIOR CANCER SURGERY'; PRENDTC=''; end;else if ItemGroupOID='IG.PR.RADIOTHERAPY' then do; PRCAT='PRIOR RADIOTHERAPY'; PRPRESP='Y'; PROCCUR=RTPRSP; PRLOC=''; PRLAT=''; if RTPRSP='Y' then PRDOSE=input(DOSETEXT,best32.); else do; PRDOSU=''; PRSTDTC=''; PRENDTC=''; end; end; else delete; run;proc sort data=prepared; by STUDYID USUBJID PRSTDTC PRTRT; run;data result; set prepared; by STUDYID USUBJID; retain PRSEQ; if first.USUBJID then PRSEQ=0; PRSEQ+1;run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, PRSEQ, PRTRT, PRCAT, PRPRESP, PROCCUR, PRLOC, PRLAT, PRDOSE, PRDOSU, PRSTDTC, PRENDTC from result;quit;proc export data=final outfile="/app/output/pr.csv" dbms=csv replace; run;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions