1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;5556 /********************* scab1.sas ***************************/57 title 'Scab Disease Data';5859 data potato;60 infile '/folders/myfolders/ScabDisease.data.txt';61 length condition $ 10.; /* Default length of character values is 8. */62 input condition $ infection;63 label infection = 'Ave percent surface covered';NOTE: The infile '/folders/myfolders/ScabDisease.data.txt' is:Filename=/folders/myfolders/ScabDisease.data.txt,Owner Name=root,Group Name=vboxsf,Access Permission=-rwxrwx---,Last Modified=08Jan2016:21:27:35,File Size (bytes)=576NOTE: 32 records were read from the infile '/folders/myfolders/ScabDisease.data.txt'.The minimum record length was 16.The maximum record length was 16.NOTE: The data set WORK.POTATO has 32 observations and 2 variables.NOTE: DATA statement used (Total process time):real time 0.01 secondscpu time 0.01 seconds64 proc freq;65 tables condition;66NOTE: There were 32 observations read from the data set WORK.POTATO.NOTE: PROCEDURE FREQ used (Total process time):real time 0.04 secondscpu time 0.04 seconds67 proc means;68 class condition;69 var infection;70NOTE: There were 32 observations read from the data set WORK.POTATO.NOTE: PROCEDURE MEANS used (Total process time):real time 0.03 secondscpu time 0.04 seconds71 proc glm;72 class condition;73 model infection = condition / clparm;74 /* clparm gives CIs for contrasts down in the estimate statements. */75 /* Pairwise multiple comparisons */76 lsmeans condition / pdiff tdiff adjust = tukey;77 lsmeans condition / pdiff tdiff adjust = bon;78 lsmeans condition / pdiff tdiff adjust = scheffe;79 /* Test some custom contrasts. Beware of alphabetical order:80 Control Fall1200 Fall300 Fall600 Spring1200 Spring300 Spring600*/81 contrast 'Overall test for comparison' condition 1 -1 0 0 0 0 0,82 condition 1 0 -1 0 0 0 0,83 condition 1 0 0 -1 0 0 0,84 condition 1 0 0 0 -1 0 0,85 condition 1 0 0 0 0 -1 0,86 condition 1 0 0 0 0 0 -1;8788 contrast 'Av. of Fall vs. Control' condition 3 -1 -1 -1 0 0 0;89 contrast 'Av. of Spring vs. Control' condition 3 0 0 0 -1 -1 -1;90 contrast 'Fall vs. Spring' condition 0 1 1 1 -1 -1 -1;9192 contrast 'Spring Amount' condition 0 0 0 0 1 -1 0,93 condition 0 0 0 0 0 1 -1;9495 contrast 'Fall Amount' condition 0 1 -1 0 0 0 0,96 condition 0 0 1 -1 0 0 0;9798 contrast 'Spr vs. Fall for 300 lbs.' condition 0 0 1 0 0 -1 0;99 contrast 'Spr vs. Fall for 600 lbs.' condition 0 0 0 1 0 0 -1;100 contrast 'Spr vs. Fall, 1200 lbs' condition 0 1 0 0 -1 0 0;101102 /* Estimate and CI for Control vs. Fall 1200 (F = t^2) */103 estimate 'Control vs. Fall 1200' condition 1 -1 0 0 0 0 0;104 estimate 'Control vs. Mean of Fall'105 condition 3 -1 -1 -1 0 0 0 / divisor = 3;106107 /* Scheffe critical value for a test of s contrasts is critval * (p-1)/s.108 For p=7 means and a single contrast, it's critval * (7-1)/1 */NOTE: PROCEDURE GLM used (Total process time):real time 2.14 secondscpu time 0.83 seconds109 proc iml;NOTE: IML Ready110 title2 'Critical value for all possible 1-df Scheffe F-tests';111 numdf = 6;111 ! /* p-1 = Numerator degrees of freedom for initial test */112 dendf = 25;112 ! /* n-p = Denominator degrees of freedom for initial test */113 alpha = 0.05;114 critval = finv(1-alpha,numdf,dendf);114 ! print critval;115 ScheffeCritval = critval*numdf;115 ! print ScheffeCritval;116NOTE: Exiting IML.NOTE: PROCEDURE IML used (Total process time):real time 0.02 secondscpu time 0.02 seconds117 proc iml;NOTE: IML Ready118 title2 'Table of Scheffe critical values for COLLECTIONS of contrasts';119 numdf = 6;119 ! /* Numerator degrees of freedom for initial test */120 dendf = 25;120 ! /* Denominator degrees of freedom for initial test */121 alpha = 0.05;122 critval = finv(1-alpha,numdf,dendf);123 zero = {0 0};123 ! S_table = repeat(zero,numdf,1);123 ! /* Make empty matrix */124 /* Label the columns */125 namz = {"Number of Contrasts in followup F-test"126 " Scheffe Critical Value"};127 mattrib S_table colname=namz;128 do i = 1 to numdf;129 s_table(|i,1|) = i;130 s_table(|i,2|) = numdf/i * critval;131 end;132 reset noname;132 ! /* Makes output look nicer in this case */133 print "Initial test has" numdf " and " dendf "degrees of freedom."134 "Using significance level alpha = " alpha;135 print s_table;136137 /* Example of subsetting vs. contrasts */138NOTE: Exiting IML.NOTE: PROCEDURE IML used (Total process time):real time 0.03 secondscpu time 0.03 seconds139 proc glm;140 title2 'Test differences among treatments excluding control';141 title3 'Using contrasts of all means (traditional)';142 class condition;143 model infection = condition;144 contrast 'Differences excluding control' condition 0 1 -1 0 0 0 0,145 condition 0 0 1 -1 0 0 0,146 condition 0 0 0 1 -1 0 0,147 condition 0 0 0 0 1 -1 0,148 condition 0 0 0 0 0 1 -1;NOTE: PROCEDURE GLM used (Total process time):real time 0.37 secondscpu time 0.16 seconds149 proc glm;150 title2 'Test differences among treatments excluding control';151 title3 'Subset the data by excluding control';152 where condition ne 'Control'; /* Case sensitive */153 class condition;154 model infection = condition;155156157 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;169