O'Reilly logo

Adaptive Tests of Significance Using Permutations of Residuals with R and SAS by Thomas W. O'Gorman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX C

SAS MACRO FOR MULTIPLE COMPARISONS PROCEDURES

Note: The SAS macro adaptall.sas must also be included. It is in Appendix B and on the file adaptall.sas.

/*

Notes:

  • 1) This macro must be included in a SAS program that also has the “adaptall” macro.
  • 2) No missing values are allowed in the dependent or independent variables.
  • 3) If variables are formatted, then the formats will need to be placed before the macro.
  • 4) The macro is to be used with a one-way layout. Do not specify anything for xr or classr; they are not used as inputs in this macro.
  • 5) The indicator variable for the groups should be specified as the xa and classa variables.
  • 6) The number of independent variables should not be specified; it will be calculated by this macro before the call to the awls macro.
  • 7) The number of observations must not exceed 10,000.

*/

%macro adaptmc(dataset=, y=, xa=, classa=,
                  seed1=, seed2=, seed3=, nperm=2000);
proc sort data=&dataset out=dsorted;
  by &classa;
data dk;
  retain k 0 ;
  keep k ;
  set dsorted end=last;
    by &classa;
  if first.&classa then do;
    k=k+1;
    call symput (‘km’,k);
    end;
  if last then output;
  run;
%do imc=2 %to &km;
%do jmc=1 %to &imc−1;
 data expand;
   length lower upper $ 8;
   retain lower upper;
   retain c 0;
   file print noprint;
   keep &y &xa newclass ia;
   set dsorted end=last;
     by &classa;
   if first.&classa then do;
       c = c + 1;
       if c = &jmc then lower=&classa;
       end;
   if c = &imc then do;
                              newclass=lower;
                              ia=1 ;
                              upper=&classa;
                              end;
                         else do;
                              newclass=&classa;
                              ia=0 ;
                              end;
if last then ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required