ods graphics on; Data AllYield2015T; Set _2015; if year = '2010' then delete; if CropType NE 'C_Wheat' then delete; Proc print ; Proc sort data = AllYield2015T; by CropType Year TillageTrt; /*running Factorial design without the rep effect but with year effect*/ %macro Rotation (var=); proc npar1way wilcoxon data = AllYield2015T; class T_System; var After_Cleaning; exact wilcoxon; run; /* Generate all comparisons (T1 T2 pairs) */ proc sql; create table comp as select * from (select distinct T_System as T1 from AllYield2015T), (select distinct T_System as T2 from AllYield2015T) where T2 > T1; create table compYield2015T as select T1, T2, T_System, After_Cleaning from comp inner join AllYield2015T on T1 = T_System or T2 = T_System order by T1, T2, T_System; quit; proc npar1way wilcoxon data = compYield2015T by T1 T2; class T_System; var After_Cleaning; exact wilcoxon; ods output WilcoxonTest=WT_results; run; proc print data=WT_results; run; /* correct p values for multiplicity */ proc multtest inpvalues=compYield2015T holm hoc fdr; run; %mend Rotation; %Rotation (var=After_Cleaning); run; endsas;