tab_ae_soc.RdThe standard AE-by-SOC/PT display: one row per system organ class (with a subject-count summary row) nested with one row per preferred term below it, split into columns by treatment.
tab_ae_soc(
adae,
adsl,
by = "TRT01P",
soc_var = "AEBODSYS",
pt_var = "AEDECOD",
...
)Adverse-event analysis dataset.
Subject-level analysis dataset; supplies the population
denominator, never adae.
Column present in both adae and adsl used to split the table
into columns. Default "TRT01P".
Column in adae holding the system organ class. Default
"AEBODSYS".
Column in adae holding the preferred term. Default
"AEDECOD".
Passed on to tern::count_occurrences() for the preferred-term
rows – the escape hatch for study-specific sorting or statistics.
An object of class c("sasparity_ae_soc", "sasparity_table")
wrapping an rtables::TableTree.
Getting subject-level vs. record-level counting right is the entire point
of this function. adae typically has multiple rows per subject (repeat
occurrences of the same term, or different terms). Every count in this
table is of subjects, not rows: built on tern::summarize_num_patients()
at the SOC level and tern::count_occurrences() at the PT level, both of
which de-duplicate by subject id before counting – a subject with three
recorded episodes of "NAUSEA" contributes 1 to the count, not 3. The
percentage denominator is always the subject count in adsl
(alt_counts_df), never nrow(adae).
By default only treatment-emergent AEs (TRTEMFL == "Y") are included
when that column is present in adae, matching tab_ae_summary().
A %aebodsys macro: PROC FREQ (or PROC SUMMARY) by AEBODSYS*AEDECOD
with a first.usubjid-within-term de-duplication step, denominators from
adsl – the Table 14.3.2 "Adverse Events by System Organ Class and
Preferred Term" display. See parity_note().
adsl <- sasparity_example("adsl")
adsl <- adsl[adsl$SAFFL == "Y", ]
adae <- sasparity_example("adae")
tab_ae_soc(adae, adsl)
#>
#> ── Adverse Events by System Organ Class and Preferred Term ──
#>
#> ℹ SAS equivalent: %aebodsys macro / PROC FREQ by AEBODSYS*AEDECOD with first.usubjid dedup (Table 14.3.2 AEs by SOC and PT)
#> ℹ Denominator: n per column = subjects in `adsl` (10 total); each SOC/PT count is subjects, not AE records
#> A B All Patients
#> (N=5) (N=5) (N=10)
#> —————————————————————————————————————————————————————————————————————————————
#> Subjects with ≥ 1 adverse event 3 (60.0%) 3 (60.0%) 6 (60.0%)
#> Total adverse events 5 3 8
#> GASTROINTESTINAL DISORDERS
#> Subjects with ≥ 1 adverse event 2 (40.0%) 1 (20.0%) 3 (30.0%)
#> Total adverse events 4 1 5
#> NAUSEA 2 (40.0%) 0 2 (20.0%)
#> VOMITING 1 (20.0%) 1 (20.0%) 2 (20.0%)
#> SKIN AND SUBCUTANEOUS TISSUE DISORDERS
#> Subjects with ≥ 1 adverse event 1 (20.0%) 1 (20.0%) 2 (20.0%)
#> Total adverse events 1 1 2
#> RASH 1 (20.0%) 1 (20.0%) 2 (20.0%)
#> CARDIAC DISORDERS
#> Subjects with ≥ 1 adverse event 0 1 (20.0%) 1 (10.0%)
#> Total adverse events 0 1 1
#> CARDIAC ARREST 0 1 (20.0%) 1 (10.0%)