SAS Program Analysis of Weights: Level and Source Contrasts - Prof. Mervyn G. Marasinghe, Study notes of Statistics

An example of a sas program that analyzes the weights of a dataset with two levels (1 and 2) and three sources (1, 2, and 3). The program uses the glm procedure to perform an analysis of variance (anova) and calculate least squares means, contrasts, and confidence intervals for the weight data. The document also includes the sas output of the analysis.

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-gxm
koofers-user-gxm 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Example E8
SAS Program
data rats;
input level source @;
do i=1 to 10;
input wt @;
output;
end;
datalines;
1 1 73 102 118 104 81 107 100 87 117 111
1 2 98 74 56 111 95 88 82 77 86 92
1 3 94 79 96 98 102 102 108 91 120 105
2 1 90 76 90 64 86 51 72 90 95 78
2 2 107 95 97 80 98 74 74 67 89 58
2 3 49 82 73 86 81 97 106 70 61 82
;
run;
proc glm ;
class level source;
model wt = level source level*source;
contrast 'animal vs. vegetable'
source 1 -2 1;
contrast 'beef vs. pork'
source 1 0 -1;
contrast 'an. vs. veg. x level '
level*source 1 -2 1 -1 2 -1;
contrast 'an. vs. veg. x level'
level*source 1 0 -1 -1 0 1;
lsmeans level*source/slice=level;
lsmeans level*source/cl pdiff adjust=tukey;
run;
pf3
pf4
pf5

Partial preview of the text

Download SAS Program Analysis of Weights: Level and Source Contrasts - Prof. Mervyn G. Marasinghe and more Study notes Statistics in PDF only on Docsity!

Example^ E8 SAS Programdata^ rats;input^ level source @;do^ i=^1 to^^10 ; input^ wt @;output;end;datalines;1 1^ 73 102 118 104

81 107 100^ 87 117 111

1 2^98 74 56 111

1 3^94 79 96 98 102 102 108

2 1^90 76 90

2 2 107^95 97

2 3^49 82 73

81 97 106^70

; run ; proc^ glm^ ; class^ level source;model^ wt = level source level*source;contrast^ 'animal vs. vegetable'source

^1 -^2 1 ; contrast 'beef vs. pork'source^1 0 -^1 ; contrast 'an. vs. veg. x level 'level*source^^1 -^2 1 -^1

-^1 ;

contrast^ 'an. vs. veg. x level'level*source

^1 0 -^1 -^1 0 1 ;

lsmeans^ levelsource/slice=level;lsmeans^ levelsource/cl

pdiff^ adjust=tukey;

run ;

SAS Output

The^ SAS^ System^

The GLM ProcedureClass^ Level^ InformationClass Levels^ Valueslevel 2 1

source^3

Number^ of Observations

Read^60

Number^ of Observations

Used^60

Contrast^

DF^ Contrast SS^ Mean

Square^ F^ Value^ Pr >

F

animal^ vs.^ vegetable^

1 264.033333^ 264.

1.23^ 0.

beef^ vs. pork^

1 2.^

2.500000^ 0.01^ 0.

an.^ vs.^ veg. x^ level^

1 1178.133333^ 1178.

5.49^ 0.

an.^ vs.^ veg. x^ level^

1 0.^

0.000000^ 0.00^ 1.0000The SAS System The^ GLM ProcedureLeast Squares^ Meanslevel source^ wt LSMEAN 1 1 100.000000 1 2 85.900000 1 3 99.500000 2 1 79.200000 2 2 83.900000 2 3 78.700000The^ SAS^ System^ The^ GLM ProcedureLeast Squares^ Meanslevel*source Effect Sliced by level

for wt Sum^ of level^ DF^

Squares^ Mean^ Square

F Value^ Pr^ > F 1 2 1280.

640.^

2.98^ 0.

164.600000^ 82.

0.38^ 0.

The^ SAS^ System^ The^ GLM ProcedureLeast Squares^ MeansAdjustment for^ Multiple Comparisons: Tukey

LSMEAN

level^ source^

wt LSMEAN^ Number 1 1

100.000000^1

85.900000^2

99.500000^3

79.200000^4

83.900000^5

78.700000^6

Least^ Squares^ Means^ for

effect level*sourcePr > |t| for H0: LSMean(i)=LSMean(j)Dependent Variable: wt i/j^1

1.0000^ 0.

0.1553^ 0.

2 0.^

0.3150^ 0.^

0.9996^ 0.

3 1.0000^ 0.

0.1811^ 0.

4 0.0283^ 0.

0.^

0.9790^ 1.

5 0.1553^ 0.

0.1811^ 0.

6 0.0230^ 0.

0.0283^ 1.