If you are interested in running a series of paired t-tests on a dataset, the macro below allows you to do so by providing as arguments the lists of variables to be used in the tests. The macro performs tests, creating a dataset of results. Then, the p-values from these tests are adjusted using proc multtest. This macro could easily be adapted to other tests doable in SAS.
%macro ttests(vars1, vars2, dataset);
data ttest_results; set _null_; run;
%let k=1;
%let dep1 = %scan(&vars1, &k);
%let dep2 = %scan(&vars2, &k);
%do %while("&dep1" NE "");
ods output TTests = t;
proc ttest data=&dataset;
paired &dep1 * &dep2;
run;
data ttest_results; set ttest_results t;
run;
%let k = %eval(&k + 1);
%let dep1 = %scan(&vars1, &k);
%let dep2 = %scan(&vars2, &k);
%end;
data ttests_pvals; set ttest_results;
rename Probt = raw_p;
run;
proc multtest inpvalues=ttests_pvals holm hoc;
run;
%mend;
