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: add absolute differential records (LYMPH, NEUT,
MONO, EOS, BASO) whose analysis value (AVAL) is the
white blood cell count times the matching differential fraction,
and flag them with the record-type flag (DTYPE).
Input: SDTM laboratory records (LB) carrying the subject
identifier (USUBJID), visit (VISIT), test code (LBTESTCD),
test name (LBTEST), and numeric result (LBSTRESN): white blood
cell counts (WBC), differential fractions (LYMLE, NEUTLE,
MONOLE, EOSLE, BASOLE), a few lab-reported absolute
differentials, and unrelated parameters.
Variables:
AVAL: the collected result on a collected record; on an added absolute record, theWBCcount times the matching differential fraction for the same subject and visit.DTYPE:CALCULATIONon an added absolute record; empty on a collected record.
Note: one record is added per subject, visit, and
differential: only when both a WBC count and that differential's
fraction are present for the subject and visit, and no record of
the new absolute parameter is already there. A differential with
a fraction but no WBC count gains nothing, and an existing
absolute record blocks only its own differential. Each
contributing parameter may appear at most once within a subject
and visit; a subject and visit with repeated WBC or fraction
results stops the run instead of using a value picked by amount
or position.
Inputs
Under review1 source fileinput/lb.csv
Edit20 rows| USUBJID | LBTESTCD | LBSTRESN | LBTEST | VISIT |
|---|---|---|---|---|
| WBC | 12 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | |
| LYMLE | 0.5 | Lymphocytes (fraction of 1) | CYCLE 1 DAY 1 | |
| WBC | 10 | Leukocyte Count (10^9/L) | CYCLE 2 DAY 1 | |
| LYMLE | 0.75 | Lymphocytes (fraction of 1) | CYCLE 2 DAY 1 | |
| WBC | 8 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | |
| LYMLE | 1.0 | Lymphocytes (fraction of 1) | CYCLE 1 DAY 1 | |
| WBC | 9 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | |
| WBC | 7 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | |
| LYMLE | 0.25 | Lymphocytes (fraction of 1) | CYCLE 1 DAY 1 | |
| LYMPH | 1.75 | Lymphocytes Abs (10^9/L) | CYCLE 1 DAY 1 | |
| NEUTLE | 0.25 | Neutrophils (fraction of 1) | CYCLE 1 DAY 1 | |
| MONOLE | 0.125 | Monocytes (fraction of 1) | CYCLE 1 DAY 1 | |
| NEUTLE | 0.75 | Neutrophils (fraction of 1) | CYCLE 1 DAY 1 | |
| NEUTLE | 0.5 | Neutrophils (fraction of 1) | CYCLE 1 DAY 1 | |
| EOSLE | 0.05 | Eosinophils (fraction of 1) | CYCLE 1 DAY 1 | |
| MONOLE | 0.2 | Monocytes (fraction of 1) | CYCLE 1 DAY 1 | |
| MONO | 1.4 | Monocytes Abs (10^9/L) | CYCLE 1 DAY 1 | |
| WBC | 6 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | |
| EOSLE | 0.25 | Eosinophils (fraction of 1) | CYCLE 1 DAY 1 | |
| BASOLE | 0.125 | Basophils (fraction of 1) | CYCLE 1 DAY 1 |
Expected output
Under review29 expected rowsexpected/adlb.csv
Edit29 rows| USUBJID | PARAMCD | AVAL | PARAM | VISIT | DTYPE |
|---|---|---|---|---|---|
| WBC | 12 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | — | |
| LYMLE | 0.5 | Lymphocytes (fraction of 1) | CYCLE 1 DAY 1 | — | |
| WBC | 10 | Leukocyte Count (10^9/L) | CYCLE 2 DAY 1 | — | |
| LYMLE | 0.75 | Lymphocytes (fraction of 1) | CYCLE 2 DAY 1 | — | |
| WBC | 8 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | — | |
| LYMLE | 1 | Lymphocytes (fraction of 1) | CYCLE 1 DAY 1 | — | |
| WBC | 9 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | — | |
| WBC | 7 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | — | |
| LYMLE | 0.25 | Lymphocytes (fraction of 1) | CYCLE 1 DAY 1 | — | |
| LYMPH | 1.75 | Lymphocytes Abs (10^9/L) | CYCLE 1 DAY 1 | — | |
| NEUTLE | 0.25 | Neutrophils (fraction of 1) | CYCLE 1 DAY 1 | — | |
| MONOLE | 0.125 | Monocytes (fraction of 1) | CYCLE 1 DAY 1 | — | |
| NEUTLE | 0.75 | Neutrophils (fraction of 1) | CYCLE 1 DAY 1 | — | |
| NEUTLE | 0.5 | Neutrophils (fraction of 1) | CYCLE 1 DAY 1 | — | |
| EOSLE | 0.05 | Eosinophils (fraction of 1) | CYCLE 1 DAY 1 | — | |
| MONOLE | 0.2 | Monocytes (fraction of 1) | CYCLE 1 DAY 1 | — | |
| MONO | 1.4 | Monocytes Abs (10^9/L) | CYCLE 1 DAY 1 | — | |
| WBC | 6 | Leukocyte Count (10^9/L) | CYCLE 1 DAY 1 | — | |
| EOSLE | 0.25 | Eosinophils (fraction of 1) | CYCLE 1 DAY 1 | — | |
| BASOLE | 0.125 | Basophils (fraction of 1) | CYCLE 1 DAY 1 | — | |
| LYMPH | 6 | Lymphocytes Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| LYMPH | 7.5 | Lymphocytes Abs (10^9/L) | CYCLE 2 DAY 1 | CALCULATION | |
| LYMPH | 8 | Lymphocytes Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| NEUT | 3 | Neutrophils Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| NEUT | 6 | Neutrophils Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| NEUT | 4.5 | Neutrophils Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| MONO | 1.5 | Monocytes Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| EOS | 1.5 | Eosinophils Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION | |
| BASO | 0.75 | Basophils Abs (10^9/L) | CYCLE 1 DAY 1 | CALCULATION |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADLB | USUBJID | Unique Subject Identifier | character | Copy value from LB.USUBJID. | Predecessor | ||
| ADLB | VISIT | Visit Name | character | Copy value from LB.VISIT. | Predecessor | ||
| ADLB | PARAMCD | Parameter Code | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADLB | PARAM | Parameter | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADLB | AVAL | Analysis Value | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADLB | DTYPE | Derivation Type | character | Set per constructed row; see the Row construction sheet. | Derived |
| Template | Include when | PARAMCD | PARAM | WBCVAL | FRACVAL | EXISTING_ABS_COUNT | AVAL | DTYPE |
|---|---|---|---|---|---|---|---|---|
| collected | Copy LB.LBTESTCD | Copy LB.LBTEST | Constant "None" | Constant "None" | Constant "None" | Copy LB.LBSTRESN | Constant "None" | |
| derived_lymph | WBCVAL IS NOT NULL AND FRACVAL IS NOT NULL AND EXISTING_ABS_COUNT IS NULL | Constant "LYMPH" | Constant "Lymphocytes Abs (10^9/L)" | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'WBC' | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'LYMLE' | Aggregate COUNT(LB.*) over records matching on the shared output keys, where LB.LBTESTCD = 'LYMPH' | Compute WBCVAL * FRACVAL | Constant "CALCULATION" |
| derived_neut | WBCVAL IS NOT NULL AND FRACVAL IS NOT NULL AND EXISTING_ABS_COUNT IS NULL | Constant "NEUT" | Constant "Neutrophils Abs (10^9/L)" | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'WBC' | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'NEUTLE' | Aggregate COUNT(LB.*) over records matching on the shared output keys, where LB.LBTESTCD = 'NEUT' | Compute WBCVAL * FRACVAL | Constant "CALCULATION" |
| derived_mono | WBCVAL IS NOT NULL AND FRACVAL IS NOT NULL AND EXISTING_ABS_COUNT IS NULL | Constant "MONO" | Constant "Monocytes Abs (10^9/L)" | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'WBC' | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'MONOLE' | Aggregate COUNT(LB.*) over records matching on the shared output keys, where LB.LBTESTCD = 'MONO' | Compute WBCVAL * FRACVAL | Constant "CALCULATION" |
| derived_eos | WBCVAL IS NOT NULL AND FRACVAL IS NOT NULL AND EXISTING_ABS_COUNT IS NULL | Constant "EOS" | Constant "Eosinophils Abs (10^9/L)" | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'WBC' | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'EOSLE' | Aggregate COUNT(LB.*) over records matching on the shared output keys, where LB.LBTESTCD = 'EOS' | Compute WBCVAL * FRACVAL | Constant "CALCULATION" |
| derived_baso | WBCVAL IS NOT NULL AND FRACVAL IS NOT NULL AND EXISTING_ABS_COUNT IS NULL | Constant "BASO" | Constant "Basophils Abs (10^9/L)" | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'WBC' | Aggregate ONLY(LB.LBSTRESN) over records matching on the shared output keys, where LB.LBTESTCD = 'BASOLE' | Aggregate COUNT(LB.*) over records matching on the shared output keys, where LB.LBTESTCD = 'BASO' | Compute WBCVAL * FRACVAL | Constant "CALCULATION" |
| 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/adam-adlb-lymphocytes/full.md
Edit26 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: USUBJID, PARAMCD, AVAL, PARAM, VISIT, DTYPE
Each LB record is a collected record in the output. On a collected record, PARAMCD is the test code, PARAM is the test name, AVAL is the collected result, and DTYPE has no value. On an added absolute record, AVAL is the WBC count times the matching differential fraction for the same subject and visit, and DTYPE is "CALCULATION". LYMPH is the added absolute parameter for the LYMLE fraction, with PARAM "Lymphocytes Abs (10^9/L)". NEUT is the added absolute parameter for the NEUTLE fraction, with PARAM "Neutrophils Abs (10^9/L)". MONO is the added absolute parameter for the MONOLE fraction, with PARAM "Monocytes Abs (10^9/L)". EOS is the added absolute parameter for the EOSLE fraction, with PARAM "Eosinophils Abs (10^9/L)". BASO is the added absolute parameter for the BASOLE fraction, with PARAM "Basophils Abs (10^9/L)". An absolute record is added for a subject, visit, and differential only when both a WBC count and that differential's fraction are present for the subject and visit and no record of that absolute parameter is already there. A differential with a fraction but no WBC count gains nothing, and an existing absolute record blocks only its own differential.
Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.
prompts/adam-adlb-lymphocytes/conventions.md
Edit18 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: USUBJID, PARAMCD, AVAL, PARAM, VISIT, DTYPE
DTYPE is "CALCULATION" or has no value.
LYMPH is the added absolute parameter for the LYMLE fraction, with PARAM "Lymphocytes Abs (10^9/L)". NEUT is the added absolute parameter for the NEUTLE fraction, with PARAM "Neutrophils Abs (10^9/L)". MONO is the added absolute parameter for the MONOLE fraction, with PARAM "Monocytes Abs (10^9/L)". EOS is the added absolute parameter for the EOSLE fraction, with PARAM "Eosinophils Abs (10^9/L)". BASO is the added absolute parameter for the BASOLE fraction, with PARAM "Basophils Abs (10^9/L)".
Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.
prompts/adam-adlb-lymphocytes/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per subject per parameter per visit.
The output dataset should contain the following columns in this order: USUBJID, PARAMCD, AVAL, PARAM, VISIT, DTYPE
Read the source datasets from /app/input and save the completed dataset as /app/output/adlb.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adlb-lymphocytes/result.R
Edit62 lines# Reference solution for the yamaa benchmark adam-adlb-lymphocytes (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)raw <- read_csv( "/app/input/lb.csv", col_types = cols(LBSTRESN = col_double(), .default = col_character())) |> rename(PARAMCD = LBTESTCD, AVAL = LBSTRESN, PARAM = LBTEST)# Keep every collected record unchanged, with DTYPE empty.collected <- raw |> select(USUBJID, PARAMCD, AVAL, PARAM, VISIT) |> mutate(DTYPE = NA_character_)# Differential fraction code -> absolute code and parameter name.differentials <- list( LYMLE = c("LYMPH", "Lymphocytes Abs (10^9/L)"), NEUTLE = c("NEUT", "Neutrophils Abs (10^9/L)"), MONOLE = c("MONO", "Monocytes Abs (10^9/L)"), EOSLE = c("EOS", "Eosinophils Abs (10^9/L)"), BASOLE = c("BASO", "Basophils Abs (10^9/L)"))wbc <- raw |> filter(PARAMCD == "WBC") |> select(USUBJID, VISIT, WBCVAL = AVAL)# One absolute record per subject and visit for each differential# fraction present with a WBC count and no absolute record yet.calc <- bind_rows(lapply(names(differentials), function(frac_code) { abs_code <- differentials[[frac_code]][1] abs_param <- differentials[[frac_code]][2] frac <- raw |> filter(PARAMCD == frac_code) |> select(USUBJID, VISIT, FRACVAL = AVAL) existing <- raw |> filter(PARAMCD == abs_code) |> distinct(USUBJID, VISIT) |> mutate(HAS_ABS = TRUE) wbc |> inner_join(frac, by = c("USUBJID", "VISIT")) |> left_join(existing, by = c("USUBJID", "VISIT")) |> filter(!is.na(WBCVAL), !is.na(FRACVAL), is.na(HAS_ABS)) |> mutate( PARAMCD = abs_code, AVAL = WBCVAL * FRACVAL, PARAM = abs_param, DTYPE = "CALCULATION" ) |> select(USUBJID, PARAMCD, AVAL, PARAM, VISIT, DTYPE)}))adlb <- bind_rows(collected, calc)dir.create("/app/output", showWarnings = FALSE)write_csv(adlb, "/app/output/adlb.csv", na = "")solutions/adam-adlb-lymphocytes/result.py
Edit103 lines# Reference solution for the yamaa benchmark adam-adlb-lymphocytes (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."""Create ADLB from LB: collected records plus calculated absolutedifferential counts (WBC count times the matching differential fraction)where the absolute parameter is not already present."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"# differential fraction test code -> (absolute parameter code, PARAM name)DIFFERENTIALS = [ ("LYMLE", "LYMPH", "Lymphocytes Abs (10^9/L)"), ("NEUTLE", "NEUT", "Neutrophils Abs (10^9/L)"), ("MONOLE", "MONO", "Monocytes Abs (10^9/L)"), ("EOSLE", "EOS", "Eosinophils Abs (10^9/L)"), ("BASOLE", "BASO", "Basophils Abs (10^9/L)"),]def format_number(value): text = f"{value:.10f}".rstrip("0").rstrip(".") return text if text not in ("", "-0") else "0"def main(): with open(os.path.join(INPUT_DIR, "lb.csv"), newline="") as handle: lb_rows = list(csv.DictReader(handle)) collected = [] wbc = {} # (subject, visit) -> WBC count (float) fractions = {} # (subject, visit, fraction code) -> fraction (float) existing = set() # (subject, visit, paramcd) among collected records group_order = [] # (subject, visit) in first-appearance order for row in lb_rows: subject = row["USUBJID"] visit = row["VISIT"] testcd = row["LBTESTCD"] key = (subject, visit) if key not in group_order: group_order.append(key) value_text = row["LBSTRESN"].strip() value = float(value_text) if value_text else None collected.append( { "USUBJID": subject, "PARAMCD": testcd, "AVAL": value_text, "PARAM": row["LBTEST"], "VISIT": visit, "DTYPE": "", } ) existing.add((subject, visit, testcd)) if value is None: continue if testcd == "WBC": wbc.setdefault(key, value) elif any(testcd == frac for frac, _, _ in DIFFERENTIALS): fractions.setdefault((subject, visit, testcd), value) added = [] for subject, visit in group_order: key = (subject, visit) if key not in wbc: continue for frac_code, abs_code, abs_name in DIFFERENTIALS: frac_key = (subject, visit, frac_code) if frac_key not in fractions: continue if (subject, visit, abs_code) in existing: continue added.append( { "USUBJID": subject, "PARAMCD": abs_code, "AVAL": format_number(wbc[key] * fractions[frac_key]), "PARAM": abs_name, "VISIT": visit, "DTYPE": "CALCULATION", } ) os.makedirs(OUTPUT_DIR, exist_ok=True) fieldnames = ["USUBJID", "PARAMCD", "AVAL", "PARAM", "VISIT", "DTYPE"] with open( os.path.join(OUTPUT_DIR, "adlb.csv"), "w", newline="" ) as handle: writer = csv.DictWriter(handle, fieldnames=fieldnames) writer.writeheader() writer.writerows(collected + added)if __name__ == "__main__": main()solutions/adam-adlb-lymphocytes/result.sas
Edit27 lines/* opensas reference solution for the yamaa benchmark adam-adlb-lymphocytes. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data lb; length USUBJID LBTESTCD LBTEST VISIT $1024; infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input USUBJID : $char1024. LBTESTCD : $char1024. LBSTRESN LBTEST : $char1024. VISIT : $char1024.;run;proc sql; create table derived asselect a.USUBJID,'LYMPH' as PARAMCD,a.LBSTRESN*b.LBSTRESN as AVAL,'Lymphocytes Abs (10^9/L)' as PARAM,a.VISIT,'CALCULATION' as DTYPE from lb as a inner join lb as b on a.USUBJID=b.USUBJID and a.VISIT=b.VISIT left join lb as c on a.USUBJID=c.USUBJID and a.VISIT=c.VISIT and c.LBTESTCD='LYMPH' where a.LBTESTCD='LYMLE' and b.LBTESTCD='WBC' and not missing(a.LBSTRESN) and not missing(b.LBSTRESN) and missing(c.LBTESTCD)union allselect a.USUBJID,'NEUT' as PARAMCD,a.LBSTRESN*b.LBSTRESN as AVAL,'Neutrophils Abs (10^9/L)' as PARAM,a.VISIT,'CALCULATION' as DTYPE from lb as a inner join lb as b on a.USUBJID=b.USUBJID and a.VISIT=b.VISIT left join lb as c on a.USUBJID=c.USUBJID and a.VISIT=c.VISIT and c.LBTESTCD='NEUT' where a.LBTESTCD='NEUTLE' and b.LBTESTCD='WBC' and not missing(a.LBSTRESN) and not missing(b.LBSTRESN) and missing(c.LBTESTCD)union allselect a.USUBJID,'MONO' as PARAMCD,a.LBSTRESN*b.LBSTRESN as AVAL,'Monocytes Abs (10^9/L)' as PARAM,a.VISIT,'CALCULATION' as DTYPE from lb as a inner join lb as b on a.USUBJID=b.USUBJID and a.VISIT=b.VISIT left join lb as c on a.USUBJID=c.USUBJID and a.VISIT=c.VISIT and c.LBTESTCD='MONO' where a.LBTESTCD='MONOLE' and b.LBTESTCD='WBC' and not missing(a.LBSTRESN) and not missing(b.LBSTRESN) and missing(c.LBTESTCD)union allselect a.USUBJID,'EOS' as PARAMCD,a.LBSTRESN*b.LBSTRESN as AVAL,'Eosinophils Abs (10^9/L)' as PARAM,a.VISIT,'CALCULATION' as DTYPE from lb as a inner join lb as b on a.USUBJID=b.USUBJID and a.VISIT=b.VISIT left join lb as c on a.USUBJID=c.USUBJID and a.VISIT=c.VISIT and c.LBTESTCD='EOS' where a.LBTESTCD='EOSLE' and b.LBTESTCD='WBC' and not missing(a.LBSTRESN) and not missing(b.LBSTRESN) and missing(c.LBTESTCD)union allselect a.USUBJID,'BASO' as PARAMCD,a.LBSTRESN*b.LBSTRESN as AVAL,'Basophils Abs (10^9/L)' as PARAM,a.VISIT,'CALCULATION' as DTYPE from lb as a inner join lb as b on a.USUBJID=b.USUBJID and a.VISIT=b.VISIT left join lb as c on a.USUBJID=c.USUBJID and a.VISIT=c.VISIT and c.LBTESTCD='BASO' where a.LBTESTCD='BASOLE' and b.LBTESTCD='WBC' and not missing(a.LBSTRESN) and not missing(b.LBSTRESN) and missing(c.LBTESTCD); quit;data collected; length PARAMCD $16 PARAM $1024 DTYPE $11; set lb; PARAMCD=LBTESTCD; PARAM=LBTEST; AVAL=LBSTRESN; run;data result; set collected derived; run;proc sql; create table final as select USUBJID, PARAMCD, AVAL, PARAM, VISIT, DTYPE from result;quit;proc export data=final outfile="/app/output/adlb.csv" dbms=csv replace; run;
yamaa