Here is a very basic example that demonstrates what I am talking about. When you run this, the tabulate procedure produces two tables for each table statement (one for each site) but includes all four clusters (a,b,c,d) when that is impossible. Clusters a & b correspond to site 1 and clusters c & d correspond to site 2. V1 is visit 1 so there is data for all clusters, v2 is 6 month visit so some of the clusters have no data. data table3;
input id site cluster $ v1 v2;
CARDS;
1 1 a 1 1
2 1 a 1 1
3 1 a 1 1
4 1 a 1 1
5 1 a 1 1
6 1 b 1 .
7 1 b 1 .
8 1 b 1 .
9 1 b 1 .
10 1 b 1 .
11 2 c 1 .
12 2 c 1 .
13 2 c 1 .
14 2 c 1 .
15 2 c 1 .
16 2 d 1 1
17 2 d 1 1
18 2 d 1 1
19 2 d 1 1
20 2 d 1 1
;
run;
proc format;
value $clusterfmt
'a' = 'Cluster A'
'b' = 'Cluster B'
'c' = 'Cluster C'
'd' = 'Cluster D'
;
run;
proc tabulate data = table3 missing;
class site;
class cluster / preloadfmt order = data;
var v1 v2;
table site = ' ', cluster ALL = 'Total', v1/ printmiss misstext = '0';
table site = ' ', cluster ALL = 'Total', v2/ printmiss misstext = '0';
format cluster $clusterfmt.;
run;
... View more