options ls=80; data soo1; input z h12 e12 h22 c22 e22 rg re; put ' z = ' z ' h12 = ' h12 ' e12 = ' e12 ' h22 = ' h22 ' c22 = ' c22 ' e22 = ' e22 ' rg = ' rg ' re = ' re; h1 = sqrt(h12); e1 = sqrt(e12); h2 = sqrt(h22); c2 = sqrt(c22); e2 = sqrt(e22); do i = 1 to 10000; ashcom = rannor(0); acom1=sqrt(z)*ashcom + sqrt(1-z)*rannor(0); acom2=sqrt(z)*ashcom + sqrt(1-z)*rannor(0); ashspec = rannor(0); aspec1=sqrt(z)*ashspec + sqrt(1-z)*rannor(0); aspec2=sqrt(z)*ashspec + sqrt(1-z)*rannor(0); ec = rannor(0); ecom1 = rannor(0); ecom2 = rannor(0); espec1 = rannor(0); espec2 = rannor(0); vart11 = h1*acom1 + e1*ecom1; vart12 = h2*sqrt(1-rg**2)*aspec1 + h2*rg*acom1 + c2*ec + e2*sqrt(1-re**2)*espec1 + e2*re*ecom1; vart21 = h1*acom2 + e1*ecom2; vart22 = h2*sqrt(1-rg**2)*aspec2 + h2*rg*acom2 + c2*ec + e2*sqrt(1-re**2)*espec2 + e2*re*ecom2; if vart11 >= 1.66 then padhd=1; if vart11 < 1.66 then padhd=0; if vart21 >= 1.66 then cadhd=1; if vart21 < 1.66 then cadhd=0; if vart12 >= 1.37 then pcd=1; if vart12 < 1.37 then pcd=0; if vart22 >= 1.37 then ccd=1; if vart22 < 1.37 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 'cldzck.dat'; put (padhd pcd cadhd ccd padhdcd cadhdcd paddonly caddonly pcdonly ccdonly) (f18.12); output; end; cards; .5 .7 .3 .5 .2 .3 .75 .75 ; run; data test; infile 'cldzck.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 'cldzck2.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 'cldzck2.dat'; input freq; data freq12; set freq1 freq2; libname dir '.'; proc freq; tables freq / out=dir.cldzp nocum nopercent; run; libname dir '.'; filename data 'predz.frq'; data dir.cldzp; set dir.cldzp; 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 cldz; infile 'predz.dat'; input count; run; data _null_; file "../comorbmx/dz.frq"; put '*'; run; filename data "../comorbmx/dz.frq"; data cldz; set cldz; file data mod; put count 1-16; Run;