/* file: makezmat.sas date: June 4, 2004 name: Brad Hammill modified by: John Preisser what: creates Z matrix for a 4 parameter association model like expression (6) of Preisser, Arcury and Quandt, AJE 2003;158:495-501. */ options nocenter ls=80; * camp is the cluster; data a; input camp worker day; y = _n_; datalines; 1 1 1 1 1 2 1 1 3 1 1 4 1 1 8 1 2 6 1 2 9 1 2 13 1 2 14 2 1 5 2 1 6 2 2 12 2 2 22 ; run; proc print data=a; run; proc sql; create table b as select a1.y as y1, a2.y as y2, (a1.camp = a2.camp) as z1, (a1.camp = a2.camp and a1.worker = a2.worker) as z2, (abs(a1.day - a2.day) < 7) as z3, calculated z2 * calculated z3 as z4 from a as a1, a as a2 where a1.y < a2.y and a1.camp eq a2.camp; quit; proc print data=b; run;