14.1.5
Medical History by System Organ Class and Preferred Term
Made 2026-10-17 from simulated data.
ONCO-EX
Table 14.1.5
Medical History by System Organ Class and Preferred Term
Safety Analysis Set
| Standard of Care (N=150) | Clinwrightinib 200 mg (N=150) | Total (N=300) | |
|---|---|---|---|
| Subjects with any medical history | 126 (84.0%) | 129 (86.0%) | 255 (85.0%) |
| Cardiac disorders | 10 (6.7%) | 6 (4.0%) | 16 (5.3%) |
| Atrial fibrillation | 10 (6.7%) | 6 (4.0%) | 16 (5.3%) |
| Endocrine disorders | 23 (15.3%) | 16 (10.7%) | 39 (13.0%) |
| Hypothyroidism | 23 (15.3%) | 16 (10.7%) | 39 (13.0%) |
| Eye disorders | 10 (6.7%) | 20 (13.3%) | 30 (10.0%) |
| Cataract | 10 (6.7%) | 20 (13.3%) | 30 (10.0%) |
| Gastrointestinal disorders | 20 (13.3%) | 20 (13.3%) | 40 (13.3%) |
| Gastrooesophageal reflux disease | 20 (13.3%) | 20 (13.3%) | 40 (13.3%) |
| Metabolism and nutrition disorders | 60 (40.0%) | 56 (37.3%) | 116 (38.7%) |
| Hypercholesterolaemia | 44 (29.3%) | 40 (26.7%) | 84 (28.0%) |
| Type 2 diabetes mellitus | 22 (14.7%) | 29 (19.3%) | 51 (17.0%) |
| Musculoskeletal and connective tissue disorders | 34 (22.7%) | 43 (28.7%) | 77 (25.7%) |
| Osteoarthritis | 34 (22.7%) | 43 (28.7%) | 77 (25.7%) |
| Psychiatric disorders | 32 (21.3%) | 43 (28.7%) | 75 (25.0%) |
| Depression | 18 (12.0%) | 25 (16.7%) | 43 (14.3%) |
| Insomnia | 16 (10.7%) | 23 (15.3%) | 39 (13.0%) |
| Reproductive system and breast disorders | 11 (7.3%) | 10 (6.7%) | 21 (7.0%) |
| Benign prostatic hyperplasia | 11 (7.3%) | 10 (6.7%) | 21 (7.0%) |
| Respiratory, thoracic and mediastinal disorders | 6 (4.0%) | 8 (5.3%) | 14 (4.7%) |
| Asthma | 6 (4.0%) | 8 (5.3%) | 14 (4.7%) |
| Surgical and medical procedures | 19 (12.7%) | 17 (11.3%) | 36 (12.0%) |
| Hysterectomy | 10 (6.7%) | 9 (6.0%) | 19 (6.3%) |
| Appendicectomy | 9 (6.0%) | 8 (5.3%) | 17 (5.7%) |
| Vascular disorders | 61 (40.7%) | 55 (36.7%) | 116 (38.7%) |
| Hypertension | 61 (40.7%) | 55 (36.7%) | 116 (38.7%) |
n (%): subjects with at least one condition (percent of N).
System organ classes in alphabetical order, preferred terms by decreasing frequency in the total.
Source: ADMH.
Program: t-14-1-5.sas
Program t-14-1-5.sas
Version 1, written from Clinwright's patterns, 2026-10-17, checks passed.
/*==== 00-header ====*/
/*----------------------------------------------------------------------------
Output : Table 14.1.5 / Medical History by System Organ Class and Preferred Term / Safety Analysis Set
Program : t-14-1-5.sas Reporting effort : CSR
ADaM : /work/adam (ADSL, ADLBC, ADLBH, ADVS, ADAE, ADEG, ADCM, ADMH, ADEX, ADRS, ADTR, ADTTE)
The header and the report step follow from the shell. The sections between
them make WORK.FINAL, one record per row of the table, in order:
_page the page (1 unless the output is paged); _pagelbl its heading or empty
_ord the row's order; _indent the label's indentation (0 = flush left)
_rowid the uuid of the shell row it shows (WORK._SHELL); one shell row may
have several (a category per value); a blank row's is blank-<n>
_kind label | stat | blank
rowlabel the row's label, as text
col1 Standard of Care|(N=xx)
col2 Clinwrightinib 200 mg|(N=xx)
col3 Total|(N=xx)
and set the big N of the column headers:
&_bign1 Standard of Care|(N=xx)
&_bign2 Clinwrightinib 200 mg|(N=xx)
&_bign3 Total|(N=xx)
/work/_lib/clinwright.sas has %ls_bign, %ls_count, %ls_stats, %ls_npct, %ls_num.
----------------------------------------------------------------------------*/
libname adam "/work/adam" access=readonly;
%include "/work/_lib/clinwright.sas";
%ls_setup;
/* The shell's rows, in order, with each column's value pattern (_xx1-_xx3). */
data work._shell;
length _page 8 _pagelbl $200 _ord 8 _indent 8 _rowid $36 _kind $5 _var $32 rowlabel $200 _xx1 $40 _xx2 $40 _xx3 $40;
_page = 1; _pagelbl = '';
_ord=1; _indent=0; _rowid='886c3970-5389-4c3f-a742-30dd0140557d'; _kind='stat'; _var=''; rowlabel='Subjects with any medical history'; _xx1='xx (xx.x%)'; _xx2='xx (xx.x%)'; _xx3='xx (xx.x%)'; output;
_ord=2; _indent=0; _rowid='blank-2'; _kind='blank'; _var=''; rowlabel=''; _xx1=''; _xx2=''; _xx3=''; output;
_ord=3; _indent=0; _rowid='7759a4b7-2a68-43f3-b6c7-6484737d621f'; _kind='stat'; _var='MHBODSYS'; rowlabel='[System organ class]'; _xx1='xx (xx.x%)'; _xx2='xx (xx.x%)'; _xx3='xx (xx.x%)'; output;
_ord=4; _indent=1; _rowid='e6a8441b-3372-4163-850e-a1632f4a49b5'; _kind='stat'; _var='MHDECOD'; rowlabel='[Preferred term]'; _xx1='xx (xx.x%)'; _xx2='xx (xx.x%)'; _xx3='xx (xx.x%)'; output;
run;
/*==== 10-data ====*/
/* Made from the output's analysis: the records of ADMH of the subjects of ADSL with SAFFL = 'Y', by TRT01A. */
/* The population's subjects, in each column they count in. */
data work._popc;
set adam.adsl(where=(saffl = 'Y'));
if trt01a in ('Standard of Care') then do; _col = 1; output; end;
if trt01a in ('Clinwrightinib 200 mg') then do; _col = 2; output; end;
_col = 3; output;
keep usubjid _col;
run;
data work._pop1; set adam.adsl(where=(saffl = 'Y')); keep usubjid trt01a; run;
proc sort data=work._pop1; by usubjid; run;
/* The records of ADMH, of the population's subjects, in each column. */
proc sort data=adam.admh(keep=usubjid saffl trt01a mhdecod mhbodsys) out=work._rec; by usubjid; run;
data work._an;
merge work._rec(in=_r drop=trt01a) work._pop1(in=_p);
by usubjid;
if _r and _p;
if trt01a in ('Standard of Care') then do; _col = 1; output; end;
if trt01a in ('Clinwrightinib 200 mg') then do; _col = 2; output; end;
_col = 3; output;
run;
data work._cols; do _col = 1 to 3; output; end; run;
%ls_bign(data=work._popc, trt=_col, values=1|2|3|1|2|3, names=_lsn1 _lsn2 _lsn3 _bign1 _bign2 _bign3);
/* Subjects and records per column. */
proc sort data=work._an(keep=usubjid _col) out=work._u; by _col usubjid; run;
data work._c;
set work._u;
by _col usubjid;
retain _n _e;
if first._col then do; _n = 0; _e = 0; end;
_e = _e + 1;
if first.usubjid then _n = _n + 1;
if last._col then output;
keep _col _n _e;
run;
proc transpose data=work._c out=work._tn(drop=_name_) prefix=_n; id _col; var _n; run;
proc transpose data=work._c out=work._te(drop=_name_) prefix=_e; id _col; var _e; run;
data work._z; _z = 1; run;
data work._g0;
merge work._z work._tn work._te;
array _nn{3} _n1-_n3;
array _ee{3} _e1-_e3;
do _i = 1 to 3; _nn{_i} = sum(_nn{_i}, 0); _ee{_i} = sum(_ee{_i}, 0); end;
_tot = _n3;
drop _i _z;
run;
/* Subjects with any medical history: any. */
data work._f; set work._g0; do _col = 1 to 3; output; end; run;
data work._k1;
length _rowid $36 _label _pagelbl $200 _v $200;
set work._f;
array _nn{3} _n1-_n3;
array _ee{3} _e1-_e3;
_rowid = '886c3970-5389-4c3f-a742-30dd0140557d';
_page = 1;
_pagelbl = '';
_k0 = 1;
_k1 = 0; _k2 = 0;
_k3 = 0; _k4 = 0;
_label = '';
_v = strip(ifc(missing(_nn{_col}), '-', %ls_num(_nn{_col}, 0))) || ' (' || strip(ifc(missing(ifn(input(symget(cats('_lsn', _col)), 8.) > 0, 100 * _nn{_col} / max(input(symget(cats('_lsn', _col)), 8.), 1), .)), '-', %ls_num(ifn(input(symget(cats('_lsn', _col)), 8.) > 0, 100 * _nn{_col} / max(input(symget(cats('_lsn', _col)), 8.), 1), .), 1))) || '%)';
keep _rowid _label _page _pagelbl _k0 _k1 _k2 _k3 _k4 _col _v;
run;
/* Per value of mhbodsys: subjects and records per column. */
proc sort data=work._an(keep=usubjid _col mhbodsys where=(not missing(mhbodsys))) out=work._u; by mhbodsys _col usubjid; run;
data work._c;
set work._u;
by mhbodsys _col usubjid;
retain _n _e;
if first._col then do; _n = 0; _e = 0; end;
_e = _e + 1;
if first.usubjid then _n = _n + 1;
if last._col then output;
keep mhbodsys _col _n _e;
run;
proc transpose data=work._c out=work._tn(drop=_name_) prefix=_n; by mhbodsys; id _col; var _n; run;
proc transpose data=work._c out=work._te(drop=_name_) prefix=_e; by mhbodsys; id _col; var _e; run;
data work._g1;
merge work._tn work._te; by mhbodsys;
array _nn{3} _n1-_n3;
array _ee{3} _e1-_e3;
do _i = 1 to 3; _nn{_i} = sum(_nn{_i}, 0); _ee{_i} = sum(_ee{_i}, 0); end;
_tot = _n3;
drop _i;
run;
proc sort data=work._g1; by mhbodsys; run;
data work._g1;
set work._g1;
_o1 = _n_;
run;
/* [System organ class]: npct of MHBODSYS. */
data work._f; set work._g1; do _col = 1 to 3; output; end; run;
proc sort data=work._f; by mhbodsys _col; run;
data work._k2;
length _rowid $36 _label _pagelbl $200 _v $200;
set work._f;
array _nn{3} _n1-_n3;
array _ee{3} _e1-_e3;
_rowid = '7759a4b7-2a68-43f3-b6c7-6484737d621f';
_page = 1;
_pagelbl = '';
_k0 = 3;
_k1 = _o1; _k2 = 0;
_k3 = 0; _k4 = 0;
_label = strip(mhbodsys);
_v = strip(ifc(missing(_nn{_col}), '-', %ls_num(_nn{_col}, 0))) || ' (' || strip(ifc(missing(ifn(input(symget(cats('_lsn', _col)), 8.) > 0, 100 * _nn{_col} / max(input(symget(cats('_lsn', _col)), 8.), 1), .)), '-', %ls_num(ifn(input(symget(cats('_lsn', _col)), 8.) > 0, 100 * _nn{_col} / max(input(symget(cats('_lsn', _col)), 8.), 1), .), 1))) || '%)';
keep _rowid _label _page _pagelbl _k0 _k1 _k2 _k3 _k4 _col _v;
run;
/* Per value of mhbodsys and mhdecod: subjects and records per column. */
proc sort data=work._an(keep=usubjid _col mhbodsys mhdecod where=(not missing(mhbodsys) and not missing(mhdecod))) out=work._u; by mhbodsys mhdecod _col usubjid; run;
data work._c;
set work._u;
by mhbodsys mhdecod _col usubjid;
retain _n _e;
if first._col then do; _n = 0; _e = 0; end;
_e = _e + 1;
if first.usubjid then _n = _n + 1;
if last._col then output;
keep mhbodsys mhdecod _col _n _e;
run;
proc transpose data=work._c out=work._tn(drop=_name_) prefix=_n; by mhbodsys mhdecod; id _col; var _n; run;
proc transpose data=work._c out=work._te(drop=_name_) prefix=_e; by mhbodsys mhdecod; id _col; var _e; run;
data work._g2;
merge work._tn work._te; by mhbodsys mhdecod;
array _nn{3} _n1-_n3;
array _ee{3} _e1-_e3;
do _i = 1 to 3; _nn{_i} = sum(_nn{_i}, 0); _ee{_i} = sum(_ee{_i}, 0); end;
_tot = _n3;
drop _i;
run;
proc sort data=work._g2; by mhbodsys descending _tot mhdecod; run;
data work._g2;
set work._g2;
by mhbodsys;
retain _r;
if first.mhbodsys then _r = 0;
_r = _r + 1;
_o2 = _r;
drop _r;
run;
proc sort data=work._g2; by mhbodsys; run;
proc sort data=work._g1(keep=mhbodsys _o1) out=work._gp; by mhbodsys; run;
data work._g2; merge work._g2(in=_in) work._gp; by mhbodsys; if _in; run;
/* [Preferred term]: npct of MHDECOD. */
data work._f; set work._g2; do _col = 1 to 3; output; end; run;
proc sort data=work._f; by mhbodsys mhdecod _col; run;
data work._k3;
length _rowid $36 _label _pagelbl $200 _v $200;
set work._f;
array _nn{3} _n1-_n3;
array _ee{3} _e1-_e3;
_rowid = 'e6a8441b-3372-4163-850e-a1632f4a49b5';
_page = 1;
_pagelbl = '';
_k0 = 3;
_k1 = _o1; _k2 = 4;
_k3 = _o2; _k4 = 0;
_label = strip(mhdecod);
_v = strip(ifc(missing(_nn{_col}), '-', %ls_num(_nn{_col}, 0))) || ' (' || strip(ifc(missing(ifn(input(symget(cats('_lsn', _col)), 8.) > 0, 100 * _nn{_col} / max(input(symget(cats('_lsn', _col)), 8.), 1), .)), '-', %ls_num(ifn(input(symget(cats('_lsn', _col)), 8.) > 0, 100 * _nn{_col} / max(input(symget(cats('_lsn', _col)), 8.), 1), .), 1))) || '%)';
keep _rowid _label _page _pagelbl _k0 _k1 _k2 _k3 _k4 _col _v;
run;
data work._cells; set work._k1 work._k2 work._k3; run;
proc sort data=work._cells; by _page _pagelbl _k0 _k1 _k2 _k3 _k4 _rowid _label _col; run;
proc transpose data=work._cells out=work._wide(drop=_name_) prefix=col;
by _page _pagelbl _k0 _k1 _k2 _k3 _k4 _rowid _label;
id _col;
var _v;
run;
proc sort data=work._wide; by _rowid; run;
proc sort data=work._shell(drop=_page _pagelbl) out=work._rows; by _rowid; run;
data work._inst;
merge work._wide(in=_w) work._rows(in=_s);
by _rowid;
if _w and _s;
if _label ne '' then rowlabel = _label;
run;
data work._fixed;
set work._shell;
if _rowid not in ('886c3970-5389-4c3f-a742-30dd0140557d' '7759a4b7-2a68-43f3-b6c7-6484737d621f' 'e6a8441b-3372-4163-850e-a1632f4a49b5');
_k0 = _ord; _k1 = 0; _k2 = 0; _k3 = 0; _k4 = 0;
run;
data work.final;
length col1 col2 col3 $200 _pagelbl $200;
set work._inst work._fixed;
run;
proc sort data=work.final; by _page _k0 _k1 _k2 _k3 _k4; run;
data work.final;
set work.final;
_ord = _n_;
keep _page _pagelbl _ord _indent _rowid _kind rowlabel col1 col2 col3;
run;
/*==== 90-report ====*/
/* 90-report: from the shell; the titles, columns, headers and footnotes are not changed here. */
%ls_need(_bign1 _bign2 _bign3);
%ls_final_check(columns=_page _pagelbl _ord _indent _rowid _kind rowlabel col1 col2 col3);
proc sort data=work.final out=work._report; by _page _ord; run;
data work._report;
set work._report;
/* Two spaces per step of indentation: the label column keeps leading spaces (asis=on). */
if _indent > 0 then rowlabel = repeat(' ', 2 * _indent - 1) || rowlabel;
run;
%let _lspaged = 0;
proc sql noprint; select count(*) into :_lspaged trimmed from work._report where _pagelbl ne ''; quit;
options orientation=portrait;
ods listing close;
ods rtf file="/work/out/t-14-1-5.rtf" style=journal;
title1 j=l "ONCO-EX" j=r "Page ~{thispage} of ~{lastpage}";
title2 j=c "Table 14.1.5";
title3 j=c "Medical History by System Organ Class and Preferred Term";
title4 j=c "Safety Analysis Set";
footnote1 j=l "n (%): subjects with at least one condition (percent of N).";
footnote2 j=l "System organ classes in alphabetical order, preferred terms by decreasing frequency in the total.";
footnote3 j=l "Source: ADMH.";
footnote4 j=l "Program: t-14-1-5.sas";
%macro _ls_report;
proc report data=work._report nowd split='|' missing style(report)={width=100%};
column _page _pagelbl _ord _indent _kind rowlabel col1 col2 col3;
define _page / order order=internal noprint;
define _pagelbl / order noprint;
define _ord / order order=internal noprint;
define _indent / display noprint;
define _kind / display noprint;
define rowlabel / display "" style(column)={cellwidth=40% asis=on} style(header)={just=l};
define col1 / display "Standard of Care|(N=&_bign1.)" style(column)={cellwidth=20% just=c} style(header)={just=c};
define col2 / display "Clinwrightinib 200 mg|(N=&_bign2.)" style(column)={cellwidth=20% just=c} style(header)={just=c};
define col3 / display "Total|(N=&_bign3.)" style(column)={cellwidth=20% just=c} style(header)={just=c};
%if &_lspaged > 0 %then %do;
compute before _pagelbl / style={just=l};
line _pagelbl $200.;
endcomp;
%end;
break after _page / page;
run;
%mend _ls_report;
%_ls_report;
ods rtf close;
ods listing;
%ls_final_export;