* example.sas * xref: * input: blex.sas * output: * does - Example how to use GEE macro. - The data step generates data at random. Its details are not important. What matters is that it generates variables:y, id, x1-x5. - Notice that x2-x3 are cluster-level covariates, while x4-x5 are observation-level covariates, x1=intercept. ***************************************************; filename BLEX "blex.sas"; %include BLEX; * options mprint; ***************************************************; data A; * generate a dataset; k = 20; * # clusters; n = 5 ; * cluster size; beta1 = 1; * parameter values; beta2 =-1; beta3 = 0; beta4 =-1; beta5 = 1; sigma = 2; seed = 2141994; retain x1 1 zero 0; array x (*) x1-x5; array beta (*) beta1-beta5; do id = 1 to k; * one cluster; e = rannor(seed); x2 = rannor(seed); x3 = rannor(seed); do j = 1 to n; * one obs.; x4 = rannor(seed); x5 = rannor(seed); lp = e * sigma; * linear predictor; do l=1 to dim(beta); lp=lp+x(l)*beta(l); end; p = 1/(1+exp(-lp)); y = (ranuni(seed) <= p); output; end; * one obs.; end; * one cluster; keep id y x1 - x5 zero; run; ***************************************************; title2 "A minimal run"; %gee ( data=A, /* required: dataset name */ yvar=y, /* required: response 0/1 */ xvar=x1 x2 x3 x4 x5, /* required: covariates */ id=id ); /* required: cluster id */ ***************************************************; title2 "Test output datasets"; %gee ( data=A, /* required: dataset name */ yvar=y, /* required: response 0/1 */ xvar=x1 x2 x3 x4 x5, /* required: covariates */ id=id, /* required: cluster id */ outest=EST, /* optional: estimates dataset */ outs=RES); /* optional: residuals dataset */ ***************************************************; proc contents data=EST; title2 "Estimates of parameters and covariance matrices"; run; ***************************************************; proc print data=EST; run; ***************************************************; proc contents data=RES; title2 "Fitted values and residuals"; run; ***************************************************; proc print data=RES; run; ***************************************************; title2 "Test the offset option"; %gee ( data=A, /* required: dataset name */ yvar=y, /* required: response 0/1 */ xvar=x1 x2 x3 x4 x5, /* required: covariates */ id=id, /* required: cluster id */ offset=zero); /* optional: offset */