|
Chapter Contents |
Previous |
Next |
| The TTEST Procedure |
title 'Group Comparison Using Input Data Set of Summary
Statistics';
data graze;
length GrazeType $ 10;
input GrazeType $ WtGain @@;
datalines;
controlled 45 controlled 62
controlled 96 controlled 128
controlled 120 controlled 99
controlled 28 controlled 50
controlled 109 controlled 115
controlled 39 controlled 96
controlled 87 controlled 100
controlled 76 controlled 80
continuous 94 continuous 12
continuous 26 continuous 89
continuous 88 continuous 96
continuous 85 continuous 130
continuous 75 continuous 54
continuous 112 continuous 69
continuous 104 continuous 95
continuous 53 continuous 21
;
run;
The variable GrazeType denotes the grazing method: `controlled' is controlled grazing and `continuous' is continuous grazing. The dollar sign ($) following GrazeType makes it a character variable, and the trailing at signs (@@) tell the procedure that there is more than one observation per line. The MEANS procedure is invoked to create a data set of summary statistics with the following statements:
proc sort;
by GrazeType;
proc means data=graze noprint;
var WtGain;
by GrazeType;
output out=newgraze;
run;
The NOPRINT option eliminates all output from the MEANS procedure. The VAR statement tells PROC MEANS to compute summary statistics for the WtGain variable, and the BY statement requests a separate set of summary statistics for each level of GrazeType. The OUTPUT OUT= statement tells PROC MEANS to put the summary statistics into a data set called newgraze so that it may be used in subsequent procedures. This new data set is displayed in Output 67.1.1 by using PROC PRINT as follows:
proc print data=newgraze; run;
The _STAT_ variable contains the names of the statistics, and the GrazeType variable indicates which group the statistic is from.
Output 67.1.1: Output Data Set of Summary Statistics
proc ttest data=newgraze;
class GrazeType;
var WtGain;
run;
The CLASS statement contains the variable that distinguishes between the groups being compared, in this case GrazeType. The summary statistics and confidence intervals are displayed first, as shown in Output 67.1.2.
Output 67.1.2: Summary Statistics|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.