1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;7071 /* pain2.sas (2020 version) */72 title 'Covariance structure repeated measures analysis of the pain data';7374 /* Read data from an old .xls spreadsheet */75 proc import datafile="/home/brunner0/441s20/Pain.xls"76 out=ouch0 dbms=xls replace;77 getnames=yes;NOTE: The import data set has 10 observations and 7 variables.NOTE: WORK.OUCH0 data set was successfully created.NOTE: PROCEDURE IMPORT used (Total process time):real time 0.00 secondsuser cpu time 0.00 secondssystem cpu time 0.01 secondsmemory 1465.12kOS Memory 32152.00kTimestamp 03/04/2020 03:51:12 PMStep Count 56 Switch Count 2Page Faults 0Page Reclaims 446Page Swaps 0Voluntary Context Switches 17Involuntary Context Switches 0Block Input Operations 56Block Output Operations 26478 proc print;7980 /* Dose 1 Dose 2 Dose 381 ------ ----- ------82 Drug 1 Drug1Dose1 Drug1Dose2 Drug1Dose383 Drug 2 Drug2Dose1 Drug2Dose2 Drug2Dose3 */84NOTE: There were 10 observations read from the data set WORK.OUCH0.NOTE: PROCEDURE PRINT used (Total process time):real time 0.03 secondsuser cpu time 0.04 secondssystem cpu time 0.00 secondsmemory 2190.71kOS Memory 31912.00kTimestamp 03/04/2020 03:51:12 PMStep Count 57 Switch Count 0Page Faults 0Page Reclaims 107Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 1Block Input Operations 0Block Output Operations 885 data hurt;86 set ouch0;87 /* Need each response on a separate line for proc mixed. */88 array response{6} Drug1Dose1 -- Drug2Dose3;89 index = 0;90 do drug = 1 to 2;91 do dose = 1 to 3;92 index = index + 1;93 pain = response{index};94 output;95 end;96 end;97 keep patient drug dose pain;98NOTE: There were 10 observations read from the data set WORK.OUCH0.NOTE: The data set WORK.HURT has 60 observations and 4 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 947.56kOS Memory 32428.00kTimestamp 03/04/2020 03:51:12 PMStep Count 58 Switch Count 2Page Faults 0Page Reclaims 149Page Swaps 0Voluntary Context Switches 15Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26499 proc print data = hurt (obs=12); /* Just the first 12 lines */100NOTE: There were 12 observations read from the data set WORK.HURT.NOTE: PROCEDURE PRINT used (Total process time):real time 0.02 secondsuser cpu time 0.02 secondssystem cpu time 0.00 secondsmemory 735.25kOS Memory 32168.00kTimestamp 03/04/2020 03:51:12 PMStep Count 59 Switch Count 0Page Faults 0Page Reclaims 61Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 0101 proc mixed data=hurt;102 title2 'Unknown covariance structure';103 class drug dose;104 model pain = drug|dose;105 repeated / type=un subject=patient;106 /* Pairwise comparisons of marginal means for Dose */107 lsmeans dose / pdiff tdiff adjust = bon;108 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.12 secondsuser cpu time 0.12 secondssystem cpu time 0.00 secondsmemory 1834.53kOS Memory 32940.00kTimestamp 03/04/2020 03:51:12 PMStep Count 60 Switch Count 3Page Faults 0Page Reclaims 308Page Swaps 0Voluntary Context Switches 22Involuntary Context Switches 1Block Input Operations 0Block Output Operations 312109110 proc mixed data=hurt;111 title2 'Compound symmetry';112 class drug dose;113 model pain = drug|dose;114 repeated / type=cs subject=patient;115 lsmeans dose / pdiff tdiff adjust = bon;116 run;NOTE: Convergence criteria met.NOTE: PROCEDURE MIXED used (Total process time):real time 0.10 secondsuser cpu time 0.10 secondssystem cpu time 0.00 secondsmemory 1272.65kOS Memory 32940.00kTimestamp 03/04/2020 03:51:12 PMStep Count 61 Switch Count 3Page Faults 0Page Reclaims 207Page Swaps 0Voluntary Context Switches 24Involuntary Context Switches 0Block Input Operations 0Block Output Operations 304117118 /* F-tests from cs do not match up with the proc glm univariate tests119 in pain1.sas that are produced as a by-product of the multivariate120 approach. If you know how to read it, output from the code below121 shows that for this (simple and quite common) example, exact classical122 F-tests for the main effects do not exist unless the interaction is123 assumed to be absent. The proc mixed tests match what you get by making124 this assumption. It seems that the "by-product" univariate repeated125 measures analysis produced by proc glm is doing something else. I do126 not know exactly what it is doing, except that in every example I can127 find where all the classical tests DO exist, proc glm matches them.128 If we want the compound symmetry assumption, we will use proc mixed. */129130 proc glm data=hurt noprint; /* Not showing the output */131 title2 'Trying classical the old fashioned way';132 class patient drug dose;133 model pain = patient drug|dose;134 random patient / test;135 run;136137138139 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;150