options ls=80; data soo1; input z h12 e12 h22 c22 e22 h32 c32 e32; put ' z = ' z ' h12 = ' h12 ' e12 = ' e12 ' h22 = ' h22 ' c22 = ' c22 ' e22 = ' e22 ' h32 = ' h32 ' c32 = ' c32 ' e32 = ' e32; h1 = sqrt(h12); e1 = sqrt(e12); h2 = sqrt(h22); c2 = sqrt(c22); e2 = sqrt(e22); h3 = sqrt(h32); c3 = sqrt(c32); e3 = sqrt(e32); do i = 1 to 10000; ash1 = rannor(0); ash2 = rannor(0); ash3 = rannor(0); a11 = sqrt(z)*ash1 + sqrt(1-z)*rannor(0); a21 = sqrt(z)*ash1 + sqrt(1-z)*rannor(0); a12 = sqrt(z)*ash2 + sqrt(1-z)*rannor(0); a22 = sqrt(z)*ash2 + sqrt(1-z)*rannor(0); a13 = sqrt(z)*ash3 + sqrt(1-z)*rannor(0); a23 = sqrt(z)*ash3 + sqrt(1-z)*rannor(0); ec2 = rannor(0); ec3 = rannor(0); ew11 = rannor(0); ew21 = rannor(0); ew12 = rannor(0); ew22 = rannor(0); ew13 = rannor(0); ew23 = rannor(0); vart11 = h1*a11 + e1*ew11; vart21 = h1*a21 + e1*ew21; vart12 = h2*a12 + c2*ec2 + e2*ew12; vart22 = h2*a22 + c2*ec2 + e2*ew22; vart13 = h3*a13 + c3*ec3 + e3*ew13; vart23 = h3*a23 + c3*ec3 + e3*ew23; if vart11 >= 1.96 or vart12 >= 1.96 then padhd=1; if vart21 >= 1.96 or vart22 >= 1.96 then cadhd=1; if vart11 < 1.96 and vart12 < 1.96 then padhd=0; if vart21 < 1.96 and vart22 < 1.96 then cadhd=0; if vart13 >=1.55 or vart12 >=1.96 then pcd=1; if vart23 >=1.55 or vart22 >=1.96 then ccd=1; if vart13 <1.55 and vart12 <1.96 then pcd=0; if vart23 <1.55 and vart22 <1.96 then ccd=0; if padhd=0 and pcd=0 then padhdcd=0; if padhd=1 and pcd=0 then padhdcd=1; if padhd=1 and pcd=1 then padhdcd=2; if padhd=0 and pcd=1 then padhdcd=3; if cadhd=0 and ccd=0 then cadhdcd=0; if cadhd=1 and ccd=0 then cadhdcd=1; if cadhd=1 and ccd=1 then cadhdcd=2; if cadhd=0 and ccd=1 then cadhdcd=3; if padhd=0 and pcd=0 then paddonly=0; if padhd=1 and pcd=0 then paddonly=1; if cadhd=0 and ccd=0 then caddonly=0; if cadhd=1 and ccd=0 then caddonly=1; if padhd=0 and pcd=0 then pcdonly=0; if padhd=0 and pcd=1 then pcdonly=1; if cadhd=0 and ccd=0 then ccdonly=0; if cadhd=0 and ccd=1 then ccdonly=1; file 'tddzck.dat'; put (padhd pcd cadhd ccd padhdcd cadhdcd paddonly caddonly pcdonly ccdonly) (f18.12); output; end; cards; .5 .7 .3 .3 .4 .3 .5 .2 .3 ; run; data test; infile 'tddzck.dat'; input (padhd pcd cadhd ccd padhdcd cadhdcd paddonly caddonly pcdonly ccdonly) (f18.12); if padhd=0 and pcd=0 and cadhd=0 and ccd=0 then f0000=1; if (padhd=0 and pcd=1 and cadhd=0 and ccd=0) or (padhd=0 and pcd=0 and cadhd=0 and ccd=1) then f0100=1; if (padhd=1 and pcd=0 and cadhd=0 and ccd=0) or (padhd=0 and pcd=0 and cadhd=1 and ccd=0) then f1000=1; if (padhd=1 and pcd=1 and cadhd=0 and ccd=0) or (padhd=0 and pcd=0 and cadhd=1 and ccd=1) then f1100=1; if padhd=0 and pcd=1 and cadhd=0 and ccd=1 then f0101=1; if (padhd=1 and pcd=0 and cadhd=0 and ccd=1) or (padhd=0 and pcd=1 and cadhd=1 and ccd=0) then f1001=1; if (padhd=1 and pcd=1 and cadhd=0 and ccd=1) or (padhd=0 and pcd=1 and cadhd=1 and ccd=1) then f1101=1; if padhd=1 and pcd=0 and cadhd=1 and ccd=0 then f1010=1; if (padhd=1 and pcd=1 and cadhd=1 and ccd=0) or (padhd=1 and pcd=0 and cadhd=1 and ccd=1) then f1110=1; if padhd=1 and pcd=1 and cadhd=1 and ccd=1 then f1111=1; if f0000=1 then freq=1; if f0100=1 then freq=2; if f1000=1 then freq=3; if f1100=1 then freq=4; if f0101=1 then freq=5; if f1001=1 then freq=6; if f1101=1 then freq=7; if f1010=1 then freq=8; if f1110=1 then freq=9; if f1111=1 then freq=10; file 'tddzck2.dat'; put freq; output; run; data dummy; infile 'dummy.dat'; input padhd pcd cadhd ccd padhdcd cadhdcd paddonly caddonly pcdonly ccdonly; if padhd=0 and pcd=0 and cadhd=0 and ccd=0 then f0000=1; if (padhd=0 and pcd=1 and cadhd=0 and ccd=0) or (padhd=0 and pcd=0 and cadhd=0 and ccd=1) then f0100=1; if (padhd=1 and pcd=0 and cadhd=0 and ccd=0) or (padhd=0 and pcd=0 and cadhd=1 and ccd=0) then f1000=1; if (padhd=1 and pcd=1 and cadhd=0 and ccd=0) or (padhd=0 and pcd=0 and cadhd=1 and ccd=1) then f1100=1; if padhd=0 and pcd=1 and cadhd=0 and ccd=1 then f0101=1; if (padhd=1 and pcd=0 and cadhd=0 and ccd=1) or (padhd=0 and pcd=1 and cadhd=1 and ccd=0) then f1001=1; if (padhd=1 and pcd=1 and cadhd=0 and ccd=1) or (padhd=0 and pcd=1 and cadhd=1 and ccd=1) then f1101=1; if padhd=1 and pcd=0 and cadhd=1 and ccd=0 then f1010=1; if (padhd=1 and pcd=1 and cadhd=1 and ccd=0) or (padhd=1 and pcd=0 and cadhd=1 and ccd=1) then f1110=1; if padhd=1 and pcd=1 and cadhd=1 and ccd=1 then f1111=1; if f0000=1 then freq=1; if f0100=1 then freq=2; if f1000=1 then freq=3; if f1100=1 then freq=4; if f0101=1 then freq=5; if f1001=1 then freq=6; if f1101=1 then freq=7; if f1010=1 then freq=8; if f1110=1 then freq=9; if f1111=1 then freq=10; file 'dummy2.dat'; put freq; output; run; data freq1; infile 'dummy2.dat'; input freq; data freq2; infile 'tddzck2.dat'; input freq; data freq12; set freq1 freq2; libname dir '.'; proc freq; tables freq / out=dir.tddzp nocum nopercent; run; libname dir '.'; filename data 'predz.frq'; data dir.tddzp; set dir.tddzp; file data; put count 9-16; Run; data predz; infile 'predz.frq'; input countp; count=countp-1; file 'predz.dat'; put count; output; run; data tddz; infile 'predz.dat'; input count; run; data _null_; file "../comorbmx/dz.frq"; put '*'; run; filename data "../comorbmx/dz.frq"; data tddz; set tddz; file data mod; put count 1-16; Run;