APPENDIX J

SAS MACRO FOR ESTIMATES

Note: The macros nextstep and adaptwtsl must be included. These are in Appendix I and on the file adaptci.sas.

/*
Note: If variables are formatted then the formats will
      need to be placed before the macro.
  */
options nocenter linesize=80 nonotes ;

%macro adaptest(dataset=, y=, xr=, xa=, seedl=, seed2=,
                seed3=, maxsteps=8000);

data dseed;
   nextl=&seedl ;
   next2=&seed2 ;
   next3=&seed3 ;
data dupdate;
   c=0 ;
data dgarth(keep=&y &xr &xa); retain n 0; set &dataset; n = n + 1 ; call symput(′ nobs′,trim(left (put (n,8 . ) ) ) ); output ; proc reg data=dgarth; model &y=&xr &xa/clb; titlel ′ Regression Analysis with no adaptation′; proc glm data=dgarth noprint; model &y=&xr; output out=dresid predicted=yhat1 residual=res; title2 ′Adaptive weighted least squares analysis′; %adaptwtsl(datares=dresid, resvars=res, nobs=&nobs, nvars=l); data dall; merge dgarth dresid dweights; proc print data=dall ; var &y &xr &xa res weight saswt; title2′ Data, after adjustment SASWT=weights used by SAS′; proc reg data=dall outest=dunperm outseb noprint; model &y = &xr &xa; weight saswt; data dtunperm(keep=tunperm beta); set dunperm; retain beta; if _type_ eq ′PARMS′ then beta=&xa; if _type_ eq ′SEB′ then do; tunperm=beta/&xa; output; end; file print noprint; titlel ′ Adaptive Weighted Least Squares Point Estimate′; title2 ′ Search method based on method proposed by ′; title3 ′ Garthwaite, P. N., Biometrics, vol. 52, 1996.′; put ; proc reg data=dgarth outest=dtheta outseb noprint; ...

Get Adaptive Tests of Significance Using Permutations of Residuals with R and SAS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.