SAS Helpful Hints
Proc Glm
General Linear Models. The heart of statistics. Here is the basic
structure and a few of the many options available in Proc Glm.
Procedure options:
Anova: Analysis of variance.
Npar1way: Nonparametric one-way analysis of
rank scores.
Reg: Simple linear regression.
Model options:
Clm: Confidence limits of predicted value
Clparm: Confidence limits of parameter estimates
Lsmeans options:
Stderr: Standard Error
Pdiff: p-values for differences
Proc Glm Data=work.A;
Class treatment gender;
Model dependent=treatment gender other_independents
treatment*gender
/ Clparm ;
Lsmeans treatment / Stderr Pdiff;
Means treatment;
Output Out=work.glmout Predicted=pred Student=stresid;
*estimate the treatment effects of a &
b, in a 2X2 factorial design;
*NOTE: a & b must be in the Model &
Class statements.
Estimate 'EFFECT OF A' a -1 1;
Estimate 'EFFECT OF B' b -1 1;
*estimate the interaction of a & b, in
a 2X2 factorial design;
*NOTE: a, b & a*b must be in the Model
& Class statements.
Estimate 'A VS. Placebo' a -1 1 a*b -1 0 1
0;
Estimate 'B VS. Placebo' b -1 1 a*b -1 1 0
0;
Estimate 'A+B VS. Placebo' a -1 1 b -1 1 a*b
-1 0 0 1;
*estimate the treatment effects in a dosage
trial;
Estimate 'Placebo vs Low' treatment -1 1 0
0 0;
Estimate 'Placebo vs Medium' treatment -1
0 1 0 0;
Estimate 'Placebo vs High' treatment -1 0
0 1 0;
Estimate 'Placebo vs Really High' treatment
-1 0 0 0 1;
Estimate 'Placebo vs All' treatment -1 0.25
0.25 0.25 0.25;
*estimate the interaction of treatment &
level;
*NOTE: treatment, level & treatment*level
must be in the model.
Estimate 'Level 1' treatment -1 1 treatment*level
-1 0 0 1 0 0;
Estimate 'Level 2' treatment -1 1 treatment*level
0 -1 0 0 1 0;
Estimate 'Level 3' treatment -1 1 treatment*level
0 0 -1 0 0 1;
Run;
*We often run the following plots for each Anova(Glm).;
Proc Plot Data=work.glmout;
Plot stresid*pred;
Label pred='Predicted' stresid='Studentized
Residuals';
Run;
Proc Rank Data=work.glmout Normal=blom Out=work.rankplot;
Var stresid;
Ranks nscores;
Run;
Proc Plot Data=work.rankplot;
Plot stresid*nscores;
Label nscores='Normal Scores' stresid='Studentized
Residuals';
Run;
Please send your comments and suggestions about this web page to A. Watts
(watts@bst.rochester.edu)
|