Clinwright Public work of Helper Software LLC · free Start free

14.3.1.4

Subjects with Treatment-Emergent Adverse Events by System Organ Class

Made 2026-10-17 from simulated data.

ONCO-EX

Figure 14.3.1.4

Subjects with Treatment-Emergent Adverse Events by System Organ Class

Safety Analysis Set

Subjects with Treatment-Emergent Adverse Events by System Organ Class

Percent of the subjects of each group.

Source: ADAE.

Program: g-14-3-1-4.sas

Program g-14-3-1-4.sas

Version 1, written from Clinwright's patterns, 2026-10-17, checks passed.

/*==== 00-header ====*/
/*----------------------------------------------------------------------------
  Output  : Figure 14.3.1.4 / Subjects with Treatment-Emergent Adverse Events by System Organ Class / Safety Analysis Set
  Program : g-14-3-1-4.sas   Reporting effort : CSR
  ADaM    : /work/adam (ADSL, ADLBC, ADLBH, ADVS, ADAE, ADEG, ADCM, ADMH, ADEX, ADRS, ADTR, ADTTE)
  A bar chart. The sections after this header make WORK.PLOT, one record per point:
    _series   the group of the point:
                1 Standard of Care
                2 Clinwrightinib 200 mg
    _x        System organ class
    _y        Subjects with an event (%)
    _mark     1 for a mark on the line (a censored subject), optional
  Clinwright draws the figure (axes, ticks, legend, at-risk numbers) from them.
----------------------------------------------------------------------------*/
libname adam "/work/adam" access=readonly;
%include "/work/_lib/clinwright.sas";
%ls_setup;

/*==== 10-data ====*/
/* Made from the output's analysis: the subjects with each value of AEBODSYS (their percentage of the group's subjects), of the records of ADAE with TRTEMFL = 'Y' of the subjects of ADSL with SAFFL = 'Y', by TRT01A. */
data work._pop1; set adam.adsl(where=(saffl = 'Y')); keep usubjid trt01a; run;
proc sort data=work._pop1; by usubjid; run;
proc sort data=adam.adae(keep=usubjid saffl aebodsys trtemfl where=(TRTEMFL = 'Y')) out=work._rec; by usubjid; run;
data work._an;
  merge work._rec(in=_r) work._pop1(in=_p);
  by usubjid;
  if _r and _p;
  if trt01a in ('Standard of Care') then do; _series = 1; output; end;
  if trt01a in ('Clinwrightinib 200 mg') then do; _series = 2; output; end;
run;
/* The population's subjects of each group: the denominators. */
data work._bd;
  set work._pop1;
  if trt01a in ('Standard of Care') then do; _series = 1; output; end;
  if trt01a in ('Clinwrightinib 200 mg') then do; _series = 2; output; end;
run;
proc sort data=work._bd nodupkey; by _series usubjid; run;
data work._bd; set work._bd; by _series; retain _d; if first._series then _d = 0; _d = _d + 1; if last._series; keep _series _d; run;
/* The subjects with each value, per group. */
proc sort data=work._an(keep=usubjid _series aebodsys  where=(not missing(aebodsys))) out=work._bs nodupkey; by _series aebodsys usubjid; run;
data work._bs; set work._bs; by _series aebodsys; retain _n; if first.aebodsys then _n = 0; _n = _n + 1; if last.aebodsys; run;
/* The categories, numbered along the x axis. */
proc sort data=work._bs(keep=aebodsys ) out=work._bk nodupkey; by aebodsys; run;
data work._bk; set work._bk; _x = _n_; length _xlbl $200; _xlbl = strip(aebodsys); keep aebodsys _x _xlbl; run;
proc sort data=work._bk; by aebodsys; run;
proc sort data=work._bs; by aebodsys; run;
data work._bs; merge work._bs(in=_in) work._bk; by aebodsys; if _in; run;
proc sort data=work._bs; by _series; run;
data work.plot;
  merge work._bs(in=_in) work._bd;
  by _series;
  if _in;
  if _d > 0 then _y = 100 * _n / _d;
  keep _series _x _y _xlbl;
run;
proc sort data=work.plot; by _series _x; run;

/*==== 90-report ====*/
/* 90-report: Clinwright draws the figure from WORK.PLOT (and WORK.ATRISK) with the shell's titles, axes and footnotes. */
%ls_plot_check(columns=_series _x _y);
%ls_plot_export;