1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;7273 /********************* scab1.sas ***************************/74 title 'Scab Disease Data';75 title2 'Read Data from an Excel Spreadsheet';7677 proc import datafile="/home/u1407221/441s24/SAS03/ScabDisease.xlsx"78 out=scab dbms=xlsx replace;79 getnames=yes;80 /* Input data file is ScabDisease.xlsx81 Ouput data table is called scab.82 dbms=xlsx The input file is an Excel spreadsheet.83 Necessary to read an Excel spreadsheet directly under unix/linux84 Works in PC environment too except for Excel 4.0 spreadsheets85 If there are multiple sheets, use sheet="sheet1" or something.86 replace If the data table already exists, replace it. Use this!87 getnames=yes Use column names as variable names. Beware of embedded,88 leading and trailing blanks.89 By default, blanks in a spreadsheet are missing. */90NOTE: One or more variables were converted because the data type is not supported by the V9 engine. For more details, run withoptions MSGLEVEL=I.NOTE: The import data set has 32 observations and 2 variables.NOTE: WORK.SCAB 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 3328.15kOS Memory 33020.00kTimestamp 01/01/2024 07:48:45 PMStep Count 97 Switch Count 4Page Faults 0Page Reclaims 816Page Swaps 0Voluntary Context Switches 29Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26491 proc print; /* By default, use the most recently created data set. */92NOTE: There were 32 observations read from the data set WORK.SCAB.NOTE: PROCEDURE PRINT used (Total process time):real time 0.03 secondsuser cpu time 0.04 secondssystem cpu time 0.00 secondsmemory 2624.37kOS Memory 31144.00kTimestamp 01/01/2024 07:48:45 PMStep Count 98 Switch Count 0Page Faults 0Page Reclaims 164Page Swaps 0Voluntary Context Switches 0Involuntary Context Switches 0Block Input Operations 0Block Output Operations 893 data potato;94 set scab;95 label infection = 'Ave percent surface covered';96NOTE: There were 32 observations read from the data set WORK.SCAB.NOTE: The data set WORK.POTATO has 32 observations and 2 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondsuser cpu time 0.00 secondssystem cpu time 0.00 secondsmemory 937.90kOS Memory 31660.00kTimestamp 01/01/2024 07:48:45 PMStep Count 99 Switch Count 2Page Faults 0Page Reclaims 198Page Swaps 0Voluntary Context Switches 11Involuntary Context Switches 0Block Input Operations 0Block Output Operations 26497 proc freq; /* Now the most recently created data set is potato. */98 tables condition;99NOTE: There were 32 observations read from the data set WORK.POTATO.NOTE: PROCEDURE FREQ used (Total process time):real time 0.02 secondsuser cpu time 0.02 secondssystem cpu time 0.00 secondsmemory 1302.93kOS Memory 31660.00kTimestamp 01/01/2024 07:48:45 PMStep Count 100 Switch Count 2Page Faults 0Page Reclaims 167Page Swaps 0Voluntary Context Switches 11Involuntary Context Switches 0Block Input Operations 0Block Output Operations 264100 proc means;101 class condition;102 var infection;103NOTE: There were 32 observations read from the data set WORK.POTATO.NOTE: PROCEDURE MEANS used (Total process time):real time 0.02 secondsuser cpu time 0.02 secondssystem cpu time 0.01 secondsmemory 8271.50kOS Memory 39868.00kTimestamp 01/01/2024 07:48:45 PMStep Count 101 Switch Count 1Page Faults 0Page Reclaims 1968Page Swaps 0Voluntary Context Switches 12Involuntary Context Switches 0Block Input Operations 0Block Output Operations 24104 proc boxplot;105 plot infection*condition; /* Deliberately unsorted */106NOTE: Since an input data set was not specified, data set POTATO is assumed as a DATA= data set.NOTE: Processing beginning for PLOT statement number 1.NOTE: There were 32 observations read from the data set WORK.POTATO.NOTE: PROCEDURE BOXPLOT used (Total process time):real time 0.24 secondsuser cpu time 0.11 secondssystem cpu time 0.03 secondsmemory 27813.68kOS Memory 57996.00kTimestamp 01/01/2024 07:48:45 PMStep Count 102 Switch Count 0Page Faults 0Page Reclaims 7265Page Swaps 0Voluntary Context Switches 914Involuntary Context Switches 0Block Input Operations 0Block Output Operations 1056107 proc glm plots=none;108 title3 'All pairwise comparisons';109 class condition;110 model infection = condition;111 /* Pairwise multiple comparisons */112 lsmeans condition / pdiff tdiff; /* No correction */113 lsmeans condition / pdiff tdiff adjust = tukey;114 lsmeans condition / pdiff tdiff adjust = bon;115 lsmeans condition / pdiff tdiff adjust = scheffe;116NOTE: PROCEDURE GLM used (Total process time):real time 0.26 secondsuser cpu time 0.26 secondssystem cpu time 0.00 secondsmemory 3077.06kOS Memory 57784.00kTimestamp 01/01/2024 07:48:45 PMStep Count 103 Switch Count 3Page Faults 0Page Reclaims 604Page Swaps 0Voluntary Context Switches 21Involuntary Context Switches 0Block Input Operations 0Block Output Operations 408117 proc glm order=data; /* Use order in data file, not alphabetical */118 title3 'Custom Tests';119 class condition;120 model infection = condition / clparm;121 /* clparm gives CIs for contrasts down in the estimate statements. */122 /* Test the custom contrasts. */123 contrast '1: Overall test, for comparison'124 condition 1 -1 0 0 0 0 0,125 condition 1 0 -1 0 0 0 0,126 condition 1 0 0 -1 0 0 0,127 condition 1 0 0 0 -1 0 0,128 condition 1 0 0 0 0 -1 0,129 condition 1 0 0 0 0 0 -1;130 contrast '2a: Spring300 vs. Control' condition 1 -1 0 0 0 0 0;131 contrast '2b: Spring600 vs. Control' condition 1 0 -1 0 0 0 0;132 contrast '2c: Spring1200 vs. Control' condition 1 0 0 -1 0 0 0;133 contrast '2d: Fall300 vs. Control' condition 1 0 0 0 -1 0 0;134 contrast '2e: Fall600 vs. Control' condition 1 0 0 0 0 -1 0;135 contrast '2f: Fall1200 vs. Control' condition 1 0 0 0 0 0 -1;136 contrast '3: Spring vs. Control' condition 3 -1 -1 -1 0 0 0;137 contrast '4: Fall vs. Control' condition 3 0 0 0 -1 -1 -1;138 contrast '5: Spring vs. Fall' condition 0 1 1 1 -1 -1 -1;139140 contrast '6: Spring Amount' condition 0 1 -1 0 0 0 0,141 condition 0 0 1 -1 0 0 0;142143 contrast '7: Fall Amount' condition 0 0 0 0 1 -1 0,144 condition 0 0 0 0 0 1 -1;145146 contrast '8a: Spr vs. Fall for 300 lbs.' condition 0 1 0 0 -1 0 0;147 contrast '8b: Spr vs. Fall for 600 lbs.' condition 0 0 1 0 0 -1 0;148 contrast '8c: Spr vs. Fall, 1200 lbs' condition 0 0 0 1 0 0 -1;149150 /* Estimate and CI for Control vs. Fall 1200 (F = t^2) */151 estimate 'Control vs. Fall 1200' condition 1 0 0 0 0 0 -1;152 estimate 'Control vs. Mean of Fall'153 condition 3 0 0 0 -1 -1 -1 / divisor = 3;154 estimate 'Spring minus Fall'155 condition 0 1 1 1 -1 -1 -1 / divisor = 3;156157 /* Scheffe critical value for a test of s contrasts is critval * (p-1)/s.158 For p=7 means and a single contrast, it's critval * (7-1)/1 */NOTE: PROCEDURE GLM used (Total process time):real time 0.24 secondsuser cpu time 0.12 secondssystem cpu time 0.01 secondsmemory 4791.62kOS Memory 59068.00kTimestamp 01/01/2024 07:48:46 PMStep Count 104 Switch Count 3Page Faults 0Page Reclaims 843Page Swaps 0Voluntary Context Switches 707Involuntary Context Switches 0Block Input Operations 0Block Output Operations 1000159 proc iml;NOTE: IML Ready160 title2 'Critical value for all possible 1-df Scheffe F-tests';161 numdf = 6;161 ! /* p-1 = Numerator degrees of freedom for initial test */162 dendf = 25;162 ! /* n-p = Denominator degrees of freedom for initial test */163 alpha = 0.05;164 critval = finv(1-alpha,numdf,dendf);164 ! print critval;165 ScheffeCritval = critval*numdf;165 ! print ScheffeCritval;166NOTE: Exiting IML.NOTE: PROCEDURE IML used (Total process time):real time 0.01 secondsuser cpu time 0.02 secondssystem cpu time 0.00 secondsmemory 487.28kOS Memory 56740.00kTimestamp 01/01/2024 07:48:46 PMStep Count 105 Switch Count 1Page Faults 0Page Reclaims 55Page Swaps 0Voluntary Context Switches 11Involuntary Context Switches 0Block Input Operations 0Block Output Operations 8167 proc iml;NOTE: IML Ready168 title2 'Table of Scheffe critical values for COLLECTIONS of contrasts';169 numdf = 6;169 ! /* Numerator degrees of freedom for initial test */170 dendf = 25;170 ! /* Denominator degrees of freedom for initial test */171 alpha = 0.05;172 critval = finv(1-alpha,numdf,dendf);173 zero = {0 0};173 ! S_table = repeat(zero,numdf,1);173 ! /* Make empty matrix */174 /* Label the columns */175 namz = {"Number of Contrasts in followup F-test"176 " Scheffe Critical Value"};177 mattrib S_table colname=namz;178 do i = 1 to numdf;179 s_table(|i,1|) = i;180 s_table(|i,2|) = numdf/i * critval;181 end;182 reset noname;182 ! /* Makes output look nicer in this case */183 print "Initial test has" numdf " and " dendf "degrees of freedom."184 "Using significance level alpha = " alpha;185 print s_table;186187 /* Example of subsetting vs. contrasts */188NOTE: Exiting IML.NOTE: PROCEDURE IML used (Total process time):real time 0.01 secondsuser cpu time 0.01 secondssystem cpu time 0.00 secondsmemory 573.65kOS Memory 56740.00kTimestamp 01/01/2024 07:48:46 PMStep Count 106 Switch Count 1Page Faults 0Page Reclaims 56Page Swaps 0Voluntary Context Switches 8Involuntary Context Switches 0Block Input Operations 0Block Output Operations 0189 proc glm;190 title2 'Test differences among treatments excluding control';191 title3 'Using contrasts of all means (traditional)';192 class condition;193 model infection = condition;194 contrast 'Differences excluding control' condition 0 1 -1 0 0 0 0,195 condition 0 0 1 -1 0 0 0,196 condition 0 0 0 1 -1 0 0,197 condition 0 0 0 0 1 -1 0,198 condition 0 0 0 0 0 1 -1;199NOTE: PROCEDURE GLM used (Total process time):real time 0.20 secondsuser cpu time 0.10 secondssystem cpu time 0.01 secondsmemory 4598.34kOS Memory 59068.00kTimestamp 01/01/2024 07:48:46 PMStep Count 107 Switch Count 4Page Faults 0Page Reclaims 726Page Swaps 0Voluntary Context Switches 722Involuntary Context Switches 0Block Input Operations 0Block Output Operations 984200 proc glm plots=none;201 title2 'Test differences among treatments excluding control';202 title3 'Subset the data by excluding control';203 where condition ne 'Control'; /* Case sensitive */204 class condition;205 model infection = condition;206207 run;208209210 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;222