The following example illustrates how a shift table presents changes in laboratory values from visit to visit. Here we consider the laboratory parameter chloride, in the laboratory group bio-chemistry. The normal range for the parameter is 98 to 107. Then the laboratory values obtained for chloride are categorized as low, normal and high according as described above. Here the lab values less than or equal to 98 are flagged as Low, the lab values within 97 and 107 are flagged as Normal and the lab values above 107 as high. There are three visits in this example screening, visit 1 and visit 2. The screening is considered as baseline visit so here we consider two cases
1. Changes occurred in lab values from screening to visit 1
2. Changes occurred in lab values from screening to visit 2
*Purpose: Illustrate how a shift table create and present;
*********************************************************;
*Give formats for Visits;
proc format;
value vsyn 0='Screening'
1='Visit-1'
2='Vist-2';
*Give formats for categories;
value flg -1='Low'
0='Normal'
1='High';
run;
data lab;
length labgrp $20 labparam $20;
format visit vsyn. flag flg.;
input SUBNO VISIT labgrp&$ labparam&$ val low high;
if val <=low then flag=-1; else if val>low and val<=high then flag=0; else if val>high then flag=1;
cards;
1 1 Bio chemistry Chloride (MMOL/L) 101 98 107
2 0 Bio chemistry Chloride (MMOL/L) 105 98 107
2 1 Bio chemistry Chloride (MMOL/L) 97 98 107
3 0 Bio chemistry Chloride (MMOL/L) 101 98 107
3 1 Bio chemistry Chloride (MMOL/L) 100 98 107
4 0 Bio chemistry Chloride (MMOL/L) 104 98 107
4 1 Bio chemistry Chloride (MMOL/L) 106 98 107
5 0 Bio chemistry Chloride (MMOL/L) 101 98 107
5 1 Bio chemistry Chloride (MMOL/L) 108 98 107
6 0 Bio chemistry Chloride (MMOL/L) 103 98 107
6 1 Bio chemistry Chloride (MMOL/L) 103 98 107
7 0 Bio chemistry Chloride (MMOL/L) 105 98 107
7 1 Bio chemistry Chloride (MMOL/L) 104 98 107
8 0 Bio chemistry Chloride (MMOL/L) 97 98 107
8 1 Bio chemistry Chloride (MMOL/L) 108 98 107
9 0 Bio chemistry Chloride (MMOL/L) 100 98 107
9 1 Bio chemistry Chloride (MMOL/L) 100 98 107
10 0 Bio chemistry Chloride (MMOL/L) 103 98 107
10 1 Bio chemistry Chloride (MMOL/L) 102 98 107
11 0 Bio chemistry Chloride (MMOL/L) 100 98 107
11 1 Bio chemistry Chloride (MMOL/L) 102 98 107
12 0 Bio chemistry Chloride (MMOL/L) 109 98 107
12 1 Bio chemistry Chloride (MMOL/L) 104 98 107
13 0 Bio chemistry Chloride (MMOL/L) 99 98 107
13 1 Bio chemistry Chloride (MMOL/L) 101 98 107
14 0 Bio chemistry Chloride (MMOL/L) 101 98 107
14 1 Bio chemistry Chloride (MMOL/L) 100 98 107
15 0 Bio chemistry Chloride (MMOL/L) 110 98 107
15 1 Bio chemistry Chloride (MMOL/L) 96 98 107
1 2 Bio chemistry Chloride (MMOL/L) 108 98 107
2 2 Bio chemistry Chloride (MMOL/L) 99 98 107
3 2 Bio chemistry Chloride (MMOL/L) 100 98 107
4 2 Bio chemistry Chloride (MMOL/L) 106 98 107
5 2 Bio chemistry Chloride (MMOL/L) 96 98 107
6 2 Bio chemistry Chloride (MMOL/L) 103 98 107
7 2 Bio chemistry Chloride (MMOL/L) 108 98 107
8 2 Bio chemistry Chloride (MMOL/L) 103 98 107
9 2 Bio chemistry Chloride (MMOL/L) 100 98 107
10 2 Bio chemistry Chloride (MMOL/L) 96 98 107
11 2 Bio chemistry Chloride (MMOL/L) 102 98 107
12 2 Bio chemistry Chloride (MMOL/L) 104 98 107
13 2 Bio chemistry Chloride (MMOL/L) 101 98 107
14 2 Bio chemistry Chloride (MMOL/L) 100 98 107
15 2 Bio chemistry Chloride (MMOL/L) 99 98 107
;
data scr (where=(visit=0)rename=(flag=flg0))
vis1(where=(visit=1)rename=(flag=flg1))
vis2(where=(visit=2)rename=(flag=flg2));
set lab;
run;
*Merge the datasets so that the flags for the three visits lie adjacent to each other;
data comon;
merge scr vis1 vis2;
run;
*Find number of subjects for all combinations of laboratory flags
from baseline (screening) to visit 1;
proc means data=comon completetypes noprint missing;
class labgrp labparam flg0 flg1 /preloadfmt ;
output out=shif01 N=num;
run;
*Transposing data into presentable format;
proc transpose data= shif01(where=(flg1 ne . and flg0 ne .)) out=trn1;
by flg0 notsorted;
id flg1;
var num;
copy labgrp labparam;
run;
*Find number of subjects for all combinations of laboratory flags from baseline (screening) to visit 2;
proc means data=comon completetypes noprint missing;
class labgrp labparam flg0 flg2 /preloadfmt ;
output out=shif02 N=num;
run;
*Transposing data into presentable format;
proc transpose data= shif02(where=(flg2 ne . and flg0 ne .)) out=trn2;
by flg0 notsorted;
id flg2;
var num;
copy labgrp labparam;
run;
*Combine two transposed datasets to create report;
data final(where=(_NAME_ ne '' and labgrp ne '' and labparam ne ''));
merge trn1
trn2(rename=(low=low2 normal=normal2 high=high2));
run;
*Determining number of subjects under each flag at baseline;
data base;
set shif01;
keep flg0 num;
where labgrp eq '' and labparam eq '' and flg1 eq . and flg0 ne .;
rename num=basenum;
run;
data final1;
merge final base;
by flg0;
run;
*rtf output of shift table;
proc report data= final1 nowd style(header)=[background=white font_size=8 pt] split='*';
column labgrp labparam flg0 ('Screening vs. Visit 1' Low Normal High ) ('Screening vs. Visit 2' Low2 Normal2 High2 ) basenum;
define labgrp/order 'Lab Group'left;
define labparam/order 'Lab Parameter' left;
define flg0/display 'Baseline *Status'left;
define Low/display 'Low' center;
define Normal/display 'Normal' center;
define High/display 'High'center;
define Low2/display 'Low'center;
define Normal2/display 'Normal'center;
define High2/display 'High'center;
define basenum/display 'Baseline*Count' center;
run;
ods rtf close;
In the table the column named ‘Baseline Count’ represents the number of low, normal and high flags at baseline visit(or screening) i.e. there is 1 subject with low flag, 11 with normal flag and 3 subjects with high flag.
The ‘Screening vs Visit 1’ section is a 3x3 contingency table. The value in first cell (first row, first column) presents the number of subjects for whom the flag was low both at Screening and Visit1. The second cell (first row, second column) further presents the number of subjects with low flag at screening and normal flag at visit1 and so on.