options formdlim = '-'; data asparagus; infile 'asparagus.txt' firstobs = 2; input trt year block yield; /* separate GLM's for each year, commented out so not run */ /* proc sort; by year; proc glm; by year; class block trt; model yield = block trt; /* followed by any bells and whistles you need or want */ /* Now compute a summary statistic (here the linear regression slope) */ /* for each e.u. (block and treatment) */ /* the outest = slopes creates a data set called slopes with the */ /* the slope for each block and trt, the slope is in the variable YEAR */ proc sort data = asparagus; by block trt; proc reg data = asparagus outest = slopes noprint; by block trt; model yield = year; proc print; title 'Slopes for each trt'; /* the variable YEAR is the slope for each eu, */ /* analysis is just the model that is appropriate for the design */ proc glm; class block trt; model year = block trt; /* Now use the means over years as the summary statistic */ /* also commented out so not run proc means data = asparagus noprint; by block trt; var yield; output out = means mean = myield; proc glm; class block trt; model myield = block trt; /* Now reshape the data to do a multivariate analysis */ /* Multivariate analysis requires data to have one row per e.u. */ /* the repeated measure is different varaibles in that row */ /* Can either reenter the data or transpose the original data */ proc sort data = asparagus; by block trt; proc transpose data = asparagus; by block trt; /* want one line per block and trt */ var yield; /* only look at the yield variable */ id year; /* year identifies where to store this value */ proc print; title ' Transposed data set in format for MANOVA'; proc glm; class block trt; model _1 _2 _3 = block trt /nouni; repeated year ; title 'Multivariate ANOVA'; run;