Clinwright Public work of Clinwright examples · free Start free

14-3.13

CIBIC+ - Categorical Analysis - LOCF

Made 2026-10-17 from uploaded data.

CDISCPILOT01

Table 14-3.13

CIBIC+ - Categorical Analysis - LOCF

Efficacy Analysis Set

Placebo (N=79)Xanomeline Low Dose (N=81)Xanomeline High Dose (N=74)p-value [1]
Week 8
n7781730.2727
Marked improvement0 (0%)0 (0%)0 (0%)
Moderate improvement1 (1%)2 (2%)1 (1%)
Minimal improvement19 (25%)16 (20%)13 (18%)
No Change45 (58%)48 (59%)38 (52%)
Minimal worsening10 (13%)14 (17%)20 (27%)
Moderate worsening2 (3%)1 (1%)1 (1%)
Marked worsening0 (0%)0 (0%)0 (0%)
Week 16
n7981740.4003
Marked improvement0 (0%)0 (0%)0 (0%)
Moderate improvement0 (0%)3 (4%)2 (3%)
Minimal improvement12 (15%)12 (15%)13 (18%)
No Change41 (52%)46 (57%)39 (53%)
Minimal worsening25 (32%)19 (23%)20 (27%)
Moderate worsening1 (1%)1 (1%)0 (0%)
Marked worsening0 (0%)0 (0%)0 (0%)
Week 24
n7981740.6180
Marked improvement0 (0%)0 (0%)0 (0%)
Moderate improvement1 (1%)1 (1%)0 (0%)
Minimal improvement9 (11%)14 (17%)11 (15%)
No Change38 (48%)37 (46%)33 (45%)
Minimal worsening28 (35%)27 (33%)25 (34%)
Moderate worsening3 (4%)2 (2%)5 (7%)
Marked worsening0 (0%)0 (0%)0 (0%)

[1] Overall comparison of treatments using CMH test (Pearson Chi-Square), controlling for site group.

Program: t-14-3-13.sas

Program t-14-3-13.sas

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

/*==== 00-header ====*/
/*----------------------------------------------------------------------------
  Output  : Table 14-3.13 / CIBIC+ - Categorical Analysis - LOCF / Efficacy Analysis Set
  Program : t-14-3-13.sas   Reporting effort : CSR
  ADaM    : /work/adam (ADSL, ADADAS, ADCIBC, ADLBC, ADLBH, ADNPIX, ADTTE, ADVS, ADAE, ADCM, ADMH, ADEX)
  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      Placebo|(N=xx)
    col2      Xanomeline Low Dose|(N=xx)
    col3      Xanomeline High Dose|(N=xx)
    col4      p-value|[1]
  and set the big N of the column headers:
    &_bign1    Placebo|(N=xx)
    &_bign2    Xanomeline Low Dose|(N=xx)
    &_bign3    Xanomeline High Dose|(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-_xx4). */
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 _xx4 $40;
  _page = 1; _pagelbl = '';
  _ord=1; _indent=0; _rowid='dfbd42ec-7c50-48e1-902e-3c14852c9d28'; _kind='label'; _var=''; rowlabel='Week 8'; _xx1=''; _xx2=''; _xx3=''; _xx4=''; output;
  _ord=2; _indent=1; _rowid='45663b26-59b6-48c0-83ae-f903dee87be2'; _kind='stat'; _var=''; rowlabel='n'; _xx1='xx'; _xx2='xx'; _xx3='xx'; _xx4='x.xxxx'; output;
  _ord=3; _indent=1; _rowid='987e5d10-24b4-4a0b-8e0c-0799e2cb47f6'; _kind='stat'; _var=''; rowlabel='Marked improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=4; _indent=1; _rowid='a020b2ec-ef4a-4c58-9503-7bbc549d9e60'; _kind='stat'; _var=''; rowlabel='Moderate improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=5; _indent=1; _rowid='1b298169-6b3c-4bf3-ba14-5318bad7ecf5'; _kind='stat'; _var=''; rowlabel='Minimal improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=6; _indent=1; _rowid='5e82b5da-6069-437d-bfcc-1a2b4efe0bae'; _kind='stat'; _var=''; rowlabel='No Change'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=7; _indent=1; _rowid='9752d976-6f7e-44de-8664-2b945bb5946c'; _kind='stat'; _var=''; rowlabel='Minimal worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=8; _indent=1; _rowid='7973ad81-6fb8-4249-9ca0-bf1ab321286b'; _kind='stat'; _var=''; rowlabel='Moderate worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=9; _indent=1; _rowid='bf40d8d4-5180-4aed-92bd-55e033fd7609'; _kind='stat'; _var=''; rowlabel='Marked worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=10; _indent=0; _rowid='blank-10'; _kind='blank'; _var=''; rowlabel=''; _xx1=''; _xx2=''; _xx3=''; _xx4=''; output;
  _ord=11; _indent=0; _rowid='f135f973-8447-415f-9f0e-c9223404262f'; _kind='label'; _var=''; rowlabel='Week 16'; _xx1=''; _xx2=''; _xx3=''; _xx4=''; output;
  _ord=12; _indent=1; _rowid='092c79d9-bd07-4ad2-84be-08078fc4fd69'; _kind='stat'; _var=''; rowlabel='n'; _xx1='xx'; _xx2='xx'; _xx3='xx'; _xx4='x.xxxx'; output;
  _ord=13; _indent=1; _rowid='4aafa996-67f6-4ff0-870f-003737551b84'; _kind='stat'; _var=''; rowlabel='Marked improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=14; _indent=1; _rowid='84a12eef-f2db-448a-a4f5-7938820ea5db'; _kind='stat'; _var=''; rowlabel='Moderate improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=15; _indent=1; _rowid='b9c300e6-c99f-4d70-850a-2106b34e9f9f'; _kind='stat'; _var=''; rowlabel='Minimal improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=16; _indent=1; _rowid='72ef9adb-d464-459e-a4d3-a7413443c724'; _kind='stat'; _var=''; rowlabel='No Change'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=17; _indent=1; _rowid='17ddf8cb-3d67-410d-8396-7bc15f088a65'; _kind='stat'; _var=''; rowlabel='Minimal worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=18; _indent=1; _rowid='accaca0b-148c-4dc3-a805-b0d10542b186'; _kind='stat'; _var=''; rowlabel='Moderate worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=19; _indent=1; _rowid='a886a7eb-9bf1-49c0-a13f-f30e7cc0c3aa'; _kind='stat'; _var=''; rowlabel='Marked worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=20; _indent=0; _rowid='blank-20'; _kind='blank'; _var=''; rowlabel=''; _xx1=''; _xx2=''; _xx3=''; _xx4=''; output;
  _ord=21; _indent=0; _rowid='6ae6852a-4322-41cf-bdee-1516d822e6a4'; _kind='label'; _var=''; rowlabel='Week 24'; _xx1=''; _xx2=''; _xx3=''; _xx4=''; output;
  _ord=22; _indent=1; _rowid='078c330d-f66f-46df-86af-bc858f261312'; _kind='stat'; _var=''; rowlabel='n'; _xx1='xx'; _xx2='xx'; _xx3='xx'; _xx4='x.xxxx'; output;
  _ord=23; _indent=1; _rowid='e8854310-3b4c-492e-a740-a486ba04e390'; _kind='stat'; _var=''; rowlabel='Marked improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=24; _indent=1; _rowid='ab9ab8c5-94af-4ea5-aba6-4c3b3cb87e0e'; _kind='stat'; _var=''; rowlabel='Moderate improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=25; _indent=1; _rowid='6a49d68c-39c7-4b55-ac62-720892efb278'; _kind='stat'; _var=''; rowlabel='Minimal improvement'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=26; _indent=1; _rowid='6518cba8-d039-4cb9-bd40-913bda2ba5c3'; _kind='stat'; _var=''; rowlabel='No Change'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=27; _indent=1; _rowid='d8405554-cea6-4445-8406-009b29e5020e'; _kind='stat'; _var=''; rowlabel='Minimal worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=28; _indent=1; _rowid='822857c4-6c65-420d-8e69-be86aa122d5a'; _kind='stat'; _var=''; rowlabel='Moderate worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
  _ord=29; _indent=1; _rowid='f7282b7f-5f52-4f17-a52f-1da1f5a840d5'; _kind='stat'; _var=''; rowlabel='Marked worsening'; _xx1='xx (xx%)'; _xx2='xx (xx%)'; _xx3='xx (xx%)'; _xx4=''; output;
run;

/*==== 10-data ====*/
/* Made from the output's analysis: the records of ADCIBC with PARAMCD = 'CIBICVAL' and ANL01FL = 'Y' of the subjects of ADSL with EFFFL = 'Y', by TRT01P. */
/* The population's subjects, in each column they count in. */
data work._popc;
  set adam.adsl(where=(efffl = 'Y'));
  if trt01p in ('Placebo') then do; _col = 1; output; end;
  if trt01p in ('Xanomeline Low Dose') then do; _col = 2; output; end;
  if trt01p in ('Xanomeline High Dose') then do; _col = 3; output; end;
  keep usubjid _col;
run;
data work._pop1; set adam.adsl(where=(efffl = 'Y')); keep usubjid trt01p; run;
proc sort data=work._pop1; by usubjid; run;
/* The records of ADCIBC with PARAMCD = 'CIBICVAL' and ANL01FL = 'Y', of the population's subjects, in each column. */
proc sort data=adam.adcibc(keep=sitegr1 usubjid efffl avisit paramcd aval anl01fl where=(PARAMCD = 'CIBICVAL' and ANL01FL = '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 trt01p in ('Placebo') then do; _col = 1; output; end;
  if trt01p in ('Xanomeline Low Dose') then do; _col = 2; output; end;
  if trt01p in ('Xanomeline High Dose') then do; _col = 3; output; end;
run;
data work._cols; do _col = 1 to 4; output; end; run;
%ls_bign(data=work._popc, trt=_col, values=1|2|3|4|1|2|3, names=_lsn1 _lsn2 _lsn3 _lsn4 _bign1 _bign2 _bign3);

data work._as1; set work._an; where avisit = 'Week 8'; run;
/* Subjects and records per column. */
proc sort data=work._as1(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{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  do _i = 1 to 4; _nn{_i} = sum(_nn{_i}, 0); _ee{_i} = sum(_ee{_i}, 0); end;
  _tot = sum(of _n1-_n4);
  drop _i _z;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* n: n of AVAL. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=_col aval) out=work._m; by _col; run;
data work._m;
  set work._m;
  by _col;
  retain _vmiss _vnm;
  if first._col then do; _vmiss = 0; _vnm = 0; end;
  if missing(aval) then _vmiss = _vmiss + 1; else _vnm = _vnm + 1;
  if last._col then output;
  keep _col _vmiss _vnm;
run;
proc sort data=work._ar(keep=usubjid _col sitegr1 aval where=(not missing(aval))) out=work._cm nodupkey; by _col sitegr1 aval usubjid; run;
data work._cm;
  set work._cm;
  by _col sitegr1 aval;
  if first.aval then _c = 0;
  _c + 1;
  if last.aval;
  _h = 0; _i = 0; _j = 0;
  if _col = 1 then do; _j = 1; end;
  if _col = 2 then do; _j = 2; end;
  if _col = 3 then do; _j = 3; end;
  if sitegr1 = '701' then _h = 1;
  if sitegr1 = '900' then _h = 2;
  if sitegr1 = '703' then _h = 3;
  if sitegr1 = '704' then _h = 4;
  if sitegr1 = '705' then _h = 5;
  if sitegr1 = '708' then _h = 6;
  if sitegr1 = '709' then _h = 7;
  if sitegr1 = '710' then _h = 8;
  if sitegr1 = '713' then _h = 9;
  if sitegr1 = '716' then _h = 10;
  if sitegr1 = '718' then _h = 11;
  if aval = 1 then _i = 1;
  if aval = 2 then _i = 2;
  if aval = 3 then _i = 3;
  if aval = 4 then _i = 4;
  if aval = 5 then _i = 5;
  if aval = 6 then _i = 6;
  if aval = 7 then _i = 7;
  if _h > 0 and _i > 0 and _j > 0;
  _ix = ((_h - 1) * 7 + _i - 1) * 3 + _j;
  keep _ix _c;
run;
proc sort data=work._cm; by _ix; run;
proc transpose data=work._cm out=work._cmw(drop=_name_) prefix=_z; id _ix; var _c; run;
data work._pp4;
  set work._cmw;
  array _zx{231} _z1-_z231;
  %ls_pcmh(p=_p4, x=_zx, s=11, r=7, c=3, scores=1 2 3 4 5 6 7);
  keep _p4;
run;
data work._f; if _n_ = 1 then set work._pp4; set work._f; run;
data work._k1;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._m;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '45663b26-59b6-48c0-83ae-f903dee87be2';
  _page = 1;
  _pagelbl = '';
  _k0 = 2;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 2 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 3 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 4 then _v = ifc(missing(_p4), '', ifc(round(sum(_p4, 0), 0.0001) < 0.0001, '<0.0001', ifc(round(sum(_p4, 0), 0.0001) > 0.9999, '>0.9999', strip(put(round(sum(_p4, 0), 0.0001), 32.4)))));
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* Marked improvement: npct of AVAL = 1. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 1)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k2;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '987e5d10-24b4-4a0b-8e0c-0799e2cb47f6';
  _page = 1;
  _pagelbl = '';
  _k0 = 3;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* Moderate improvement: npct of AVAL = 2. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 2)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k3;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'a020b2ec-ef4a-4c58-9503-7bbc549d9e60';
  _page = 1;
  _pagelbl = '';
  _k0 = 4;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* Minimal improvement: npct of AVAL = 3. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 3)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k4;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '1b298169-6b3c-4bf3-ba14-5318bad7ecf5';
  _page = 1;
  _pagelbl = '';
  _k0 = 5;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* No Change: npct of AVAL = 4. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 4)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k5;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '5e82b5da-6069-437d-bfcc-1a2b4efe0bae';
  _page = 1;
  _pagelbl = '';
  _k0 = 6;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* Minimal worsening: npct of AVAL = 5. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 5)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k6;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '9752d976-6f7e-44de-8664-2b945bb5946c';
  _page = 1;
  _pagelbl = '';
  _k0 = 7;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* Moderate worsening: npct of AVAL = 6. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 6)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k7;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '7973ad81-6fb8-4249-9ca0-bf1ab321286b';
  _page = 1;
  _pagelbl = '';
  _k0 = 8;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 8'; run;
/* Marked worsening: npct of AVAL = 7. */
data work._f; set work._g0; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 7)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k8;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'bf40d8d4-5180-4aed-92bd-55e033fd7609';
  _page = 1;
  _pagelbl = '';
  _k0 = 9;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._as2; set work._an; where avisit = 'Week 16'; run;
/* Subjects and records per column. */
proc sort data=work._as2(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._g1;
  merge work._z work._tn work._te;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  do _i = 1 to 4; _nn{_i} = sum(_nn{_i}, 0); _ee{_i} = sum(_ee{_i}, 0); end;
  _tot = sum(of _n1-_n4);
  drop _i _z;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* n: n of AVAL. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=_col aval) out=work._m; by _col; run;
data work._m;
  set work._m;
  by _col;
  retain _vmiss _vnm;
  if first._col then do; _vmiss = 0; _vnm = 0; end;
  if missing(aval) then _vmiss = _vmiss + 1; else _vnm = _vnm + 1;
  if last._col then output;
  keep _col _vmiss _vnm;
run;
proc sort data=work._ar(keep=usubjid _col sitegr1 aval where=(not missing(aval))) out=work._cm nodupkey; by _col sitegr1 aval usubjid; run;
data work._cm;
  set work._cm;
  by _col sitegr1 aval;
  if first.aval then _c = 0;
  _c + 1;
  if last.aval;
  _h = 0; _i = 0; _j = 0;
  if _col = 1 then do; _j = 1; end;
  if _col = 2 then do; _j = 2; end;
  if _col = 3 then do; _j = 3; end;
  if sitegr1 = '701' then _h = 1;
  if sitegr1 = '900' then _h = 2;
  if sitegr1 = '703' then _h = 3;
  if sitegr1 = '704' then _h = 4;
  if sitegr1 = '705' then _h = 5;
  if sitegr1 = '708' then _h = 6;
  if sitegr1 = '709' then _h = 7;
  if sitegr1 = '710' then _h = 8;
  if sitegr1 = '713' then _h = 9;
  if sitegr1 = '716' then _h = 10;
  if sitegr1 = '718' then _h = 11;
  if aval = 1 then _i = 1;
  if aval = 2 then _i = 2;
  if aval = 3 then _i = 3;
  if aval = 4 then _i = 4;
  if aval = 5 then _i = 5;
  if aval = 6 then _i = 6;
  if aval = 7 then _i = 7;
  if _h > 0 and _i > 0 and _j > 0;
  _ix = ((_h - 1) * 7 + _i - 1) * 3 + _j;
  keep _ix _c;
run;
proc sort data=work._cm; by _ix; run;
proc transpose data=work._cm out=work._cmw(drop=_name_) prefix=_z; id _ix; var _c; run;
data work._pp4;
  set work._cmw;
  array _zx{231} _z1-_z231;
  %ls_pcmh(p=_p4, x=_zx, s=11, r=7, c=3, scores=1 2 3 4 5 6 7);
  keep _p4;
run;
data work._f; if _n_ = 1 then set work._pp4; set work._f; run;
data work._k9;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._m;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '092c79d9-bd07-4ad2-84be-08078fc4fd69';
  _page = 1;
  _pagelbl = '';
  _k0 = 12;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 2 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 3 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 4 then _v = ifc(missing(_p4), '', ifc(round(sum(_p4, 0), 0.0001) < 0.0001, '<0.0001', ifc(round(sum(_p4, 0), 0.0001) > 0.9999, '>0.9999', strip(put(round(sum(_p4, 0), 0.0001), 32.4)))));
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* Marked improvement: npct of AVAL = 1. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 1)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k10;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '4aafa996-67f6-4ff0-870f-003737551b84';
  _page = 1;
  _pagelbl = '';
  _k0 = 13;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* Moderate improvement: npct of AVAL = 2. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 2)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k11;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '84a12eef-f2db-448a-a4f5-7938820ea5db';
  _page = 1;
  _pagelbl = '';
  _k0 = 14;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* Minimal improvement: npct of AVAL = 3. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 3)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k12;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'b9c300e6-c99f-4d70-850a-2106b34e9f9f';
  _page = 1;
  _pagelbl = '';
  _k0 = 15;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* No Change: npct of AVAL = 4. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 4)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k13;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '72ef9adb-d464-459e-a4d3-a7413443c724';
  _page = 1;
  _pagelbl = '';
  _k0 = 16;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* Minimal worsening: npct of AVAL = 5. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 5)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k14;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '17ddf8cb-3d67-410d-8396-7bc15f088a65';
  _page = 1;
  _pagelbl = '';
  _k0 = 17;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* Moderate worsening: npct of AVAL = 6. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 6)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k15;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'accaca0b-148c-4dc3-a805-b0d10542b186';
  _page = 1;
  _pagelbl = '';
  _k0 = 18;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 16'; run;
/* Marked worsening: npct of AVAL = 7. */
data work._f; set work._g1; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 7)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k16;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'a886a7eb-9bf1-49c0-a13f-f30e7cc0c3aa';
  _page = 1;
  _pagelbl = '';
  _k0 = 19;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._as3; set work._an; where avisit = 'Week 24'; run;
/* Subjects and records per column. */
proc sort data=work._as3(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._g2;
  merge work._z work._tn work._te;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  do _i = 1 to 4; _nn{_i} = sum(_nn{_i}, 0); _ee{_i} = sum(_ee{_i}, 0); end;
  _tot = sum(of _n1-_n4);
  drop _i _z;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* n: n of AVAL. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=_col aval) out=work._m; by _col; run;
data work._m;
  set work._m;
  by _col;
  retain _vmiss _vnm;
  if first._col then do; _vmiss = 0; _vnm = 0; end;
  if missing(aval) then _vmiss = _vmiss + 1; else _vnm = _vnm + 1;
  if last._col then output;
  keep _col _vmiss _vnm;
run;
proc sort data=work._ar(keep=usubjid _col sitegr1 aval where=(not missing(aval))) out=work._cm nodupkey; by _col sitegr1 aval usubjid; run;
data work._cm;
  set work._cm;
  by _col sitegr1 aval;
  if first.aval then _c = 0;
  _c + 1;
  if last.aval;
  _h = 0; _i = 0; _j = 0;
  if _col = 1 then do; _j = 1; end;
  if _col = 2 then do; _j = 2; end;
  if _col = 3 then do; _j = 3; end;
  if sitegr1 = '701' then _h = 1;
  if sitegr1 = '900' then _h = 2;
  if sitegr1 = '703' then _h = 3;
  if sitegr1 = '704' then _h = 4;
  if sitegr1 = '705' then _h = 5;
  if sitegr1 = '708' then _h = 6;
  if sitegr1 = '709' then _h = 7;
  if sitegr1 = '710' then _h = 8;
  if sitegr1 = '713' then _h = 9;
  if sitegr1 = '716' then _h = 10;
  if sitegr1 = '718' then _h = 11;
  if aval = 1 then _i = 1;
  if aval = 2 then _i = 2;
  if aval = 3 then _i = 3;
  if aval = 4 then _i = 4;
  if aval = 5 then _i = 5;
  if aval = 6 then _i = 6;
  if aval = 7 then _i = 7;
  if _h > 0 and _i > 0 and _j > 0;
  _ix = ((_h - 1) * 7 + _i - 1) * 3 + _j;
  keep _ix _c;
run;
proc sort data=work._cm; by _ix; run;
proc transpose data=work._cm out=work._cmw(drop=_name_) prefix=_z; id _ix; var _c; run;
data work._pp4;
  set work._cmw;
  array _zx{231} _z1-_z231;
  %ls_pcmh(p=_p4, x=_zx, s=11, r=7, c=3, scores=1 2 3 4 5 6 7);
  keep _p4;
run;
data work._f; if _n_ = 1 then set work._pp4; set work._f; run;
data work._k17;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._m;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '078c330d-f66f-46df-86af-bc858f261312';
  _page = 1;
  _pagelbl = '';
  _k0 = 22;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 2 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 3 then _v = strip(ifc(missing(sum(_vnm, 0)), '-', %ls_num(sum(_vnm, 0), 0)));
  else if _col = 4 then _v = ifc(missing(_p4), '', ifc(round(sum(_p4, 0), 0.0001) < 0.0001, '<0.0001', ifc(round(sum(_p4, 0), 0.0001) > 0.9999, '>0.9999', strip(put(round(sum(_p4, 0), 0.0001), 32.4)))));
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* Marked improvement: npct of AVAL = 1. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 1)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k18;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'e8854310-3b4c-492e-a740-a486ba04e390';
  _page = 1;
  _pagelbl = '';
  _k0 = 23;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* Moderate improvement: npct of AVAL = 2. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 2)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k19;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'ab9ab8c5-94af-4ea5-aba6-4c3b3cb87e0e';
  _page = 1;
  _pagelbl = '';
  _k0 = 24;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* Minimal improvement: npct of AVAL = 3. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 3)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k20;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '6a49d68c-39c7-4b55-ac62-720892efb278';
  _page = 1;
  _pagelbl = '';
  _k0 = 25;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* No Change: npct of AVAL = 4. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 4)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k21;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '6518cba8-d039-4cb9-bd40-913bda2ba5c3';
  _page = 1;
  _pagelbl = '';
  _k0 = 26;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* Minimal worsening: npct of AVAL = 5. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 5)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k22;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'd8405554-cea6-4445-8406-009b29e5020e';
  _page = 1;
  _pagelbl = '';
  _k0 = 27;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* Moderate worsening: npct of AVAL = 6. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 6)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k23;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = '822857c4-6c65-420d-8e69-be86aa122d5a';
  _page = 1;
  _pagelbl = '';
  _k0 = 28;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;
data work._ar; set work._an; where avisit = 'Week 24'; run;
/* Marked worsening: npct of AVAL = 7. */
data work._f; set work._g2; do _col = 1 to 4; output; end; run;
proc sort data=work._ar(keep=usubjid _col aval where=(aval = 7)) out=work._v; by _col usubjid; run;
data work._v;
  set work._v;
  by _col usubjid;
  retain _vn _ve;
  if first._col then do; _vn = 0; _ve = 0; end;
  _ve = _ve + 1;
  if first.usubjid then _vn = _vn + 1;
  if last._col then output;
  keep _col _vn _ve;
run;
proc sort data=work._ar(keep=usubjid _col aval where=(not missing(aval))) out=work._d; by _col usubjid; run;
data work._d;
  set work._d;
  by _col usubjid;
  retain _dn _de;
  if first._col then do; _dn = 0; _de = 0; end;
  _de = _de + 1;
  if first.usubjid then _dn = _dn + 1;
  if last._col then output;
  keep _col _dn _de;
run;
data work._k24;
  length _rowid $36 _label _pagelbl $200 _v $200;
  merge work._f(in=_in) work._v work._d;
  by _col;
  if _in;
  array _nn{4} _n1-_n4;
  array _ee{4} _e1-_e4;
  _rowid = 'f7282b7f-5f52-4f17-a52f-1da1f5a840d5';
  _page = 1;
  _pagelbl = '';
  _k0 = 29;
  _label = '';
  if _col = 1 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 2 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 3 then _v = strip(ifc(missing(sum(_vn, 0)), '-', %ls_num(sum(_vn, 0), 0))) || ' (' || strip(ifc(missing(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .)), '-', %ls_num(ifn(sum(_dn, 0) > 0, 100 * sum(_vn, 0) / max(sum(_dn, 0), 1), .), 0))) || '%)';
  else if _col = 4 then _v = '';
  keep _rowid _label _page _pagelbl _k0 _col _v;
run;

data work._cells; set work._k1 work._k2 work._k3 work._k4 work._k5 work._k6 work._k7 work._k8 work._k9 work._k10 work._k11 work._k12 work._k13 work._k14 work._k15 work._k16 work._k17 work._k18 work._k19 work._k20 work._k21 work._k22 work._k23 work._k24; run;
proc sort data=work._cells; by _page _pagelbl _k0 _rowid _label _col; run;
proc transpose data=work._cells out=work._wide(drop=_name_) prefix=col;
  by _page _pagelbl _k0 _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 ('45663b26-59b6-48c0-83ae-f903dee87be2' '987e5d10-24b4-4a0b-8e0c-0799e2cb47f6' 'a020b2ec-ef4a-4c58-9503-7bbc549d9e60' '1b298169-6b3c-4bf3-ba14-5318bad7ecf5' '5e82b5da-6069-437d-bfcc-1a2b4efe0bae' '9752d976-6f7e-44de-8664-2b945bb5946c' '7973ad81-6fb8-4249-9ca0-bf1ab321286b' 'bf40d8d4-5180-4aed-92bd-55e033fd7609' '092c79d9-bd07-4ad2-84be-08078fc4fd69' '4aafa996-67f6-4ff0-870f-003737551b84' '84a12eef-f2db-448a-a4f5-7938820ea5db' 'b9c300e6-c99f-4d70-850a-2106b34e9f9f' '72ef9adb-d464-459e-a4d3-a7413443c724' '17ddf8cb-3d67-410d-8396-7bc15f088a65' 'accaca0b-148c-4dc3-a805-b0d10542b186' 'a886a7eb-9bf1-49c0-a13f-f30e7cc0c3aa' '078c330d-f66f-46df-86af-bc858f261312' 'e8854310-3b4c-492e-a740-a486ba04e390' 'ab9ab8c5-94af-4ea5-aba6-4c3b3cb87e0e' '6a49d68c-39c7-4b55-ac62-720892efb278' '6518cba8-d039-4cb9-bd40-913bda2ba5c3' 'd8405554-cea6-4445-8406-009b29e5020e' '822857c4-6c65-420d-8e69-be86aa122d5a' 'f7282b7f-5f52-4f17-a52f-1da1f5a840d5');
  _k0 = _ord;
run;
data work.final;
  length col1 col2 col3 col4 $200 _pagelbl $200;
  set work._inst work._fixed;
run;
proc sort data=work.final; by _page _k0; run;
data work.final;
  set work.final;
  _ord = _n_;
  keep _page _pagelbl _ord _indent _rowid _kind rowlabel col1 col2 col3 col4;
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 col4);
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=landscape;
ods listing close;
ods rtf file="/work/out/t-14-3-13.rtf" style=journal;
title1 j=l "CDISCPILOT01" j=r "Page ~{thispage} of ~{lastpage}";
title2 j=c "Table 14-3.13";
title3 j=c "CIBIC+ - Categorical Analysis - LOCF";
title4 j=c "Efficacy Analysis Set";
footnote1 j=l "[1] Overall comparison of treatments using CMH test (Pearson Chi-Square), controlling for site group.";
footnote2 j=l "Program: t-14-3-13.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 col4;
  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 "Placebo|(N=&_bign1.)" style(column)={cellwidth=15% just=c} style(header)={just=c};
  define col2 / display "Xanomeline Low Dose|(N=&_bign2.)" style(column)={cellwidth=15% just=c} style(header)={just=c};
  define col3 / display "Xanomeline High Dose|(N=&_bign3.)" style(column)={cellwidth=15% just=c} style(header)={just=c};
  define col4 / display "p-value|[1]" style(column)={cellwidth=15% 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;