/* rats.sas Description of litters of rats data A litter-matched study of the tumorigenesis of a drug. Rats were taken from 50 distinct litters, and one rat of the litter was randomly selected and given the drug. For each litter, two rats were selected as controls and were given a placebo. All mice were females. Possible associations between litter mates in their times to development of tumors may be due to common genetic backgrounds. The variables represented in the dataset are as follows: Time to tumor development Indicator of tumor development (1=yes, 0=no) Treatment (1=treated with drug, 0=given placebo) Litter Reference Mantel et al. Cancer Research 37 (1977): 3863-3868. */ options nocenter linesize=80; data a; infile 'H:\bios180\coursepack\SAS-unc-workshop-2008\rats.dat'; input time delta trt litter; run; proc sort data=a; by litter; run; proc phreg data=a covs(aggregate); model time*delta(0)=trt; id litter; run; /* The following is an old way to get the robust variance; proc phreg data=a; model time*delta(0)=trt; output out=temp1 dfbeta=dftrt; id litter; run; proc sort data=temp1; by litter; run; proc means data=temp1 noprint; * add up rows to get D tilde; by litter; var dftrt; output out=temp2 sum=trt; run; proc iml; use temp2; read all var{trt} into x; v=x` * x; reset noname; vname="trt"; print, "Robust variance matrix",,v[colname=vname rowname=vname]; create est1 from v[colname=vname rowname=vname]; append from v[rowname=vname]; quit; */