Example SAS programs
SAS programs that have been discussed in class are included
here. You can copy a program to your PC or vincent account by
following the link to the program (so that you are looking at the
program), then selecting
SAVE AS from the FILE menu.
You can copy the file to the SAS program editor window by
selecting Open from the SAS File menu, moving to the appropriate
directory, selecting the program, then clicking OK.
- Power.sas Proc power for 2 sample,
1 sample t-tests, and contrasts
- Tomato.sas SAS program for tomato
data, using infile for input
- Tomato2.sas SAS program for tomato
data, using datalines for input.
- Salinity.sas Estimation of
variance components using PROC MIXED. Test of variance component=0.
- blockex.sas Analysis of block
design using data from Mead, Curnow and Hasted, example in section
Illustrate fixed blocks analysis using prog glm;
Data from two treatments in 10
blocks. Uses data in mead53.txt (one row per observation)
- brome.sas Analysis of a Latin
Square, using as example a study of management of a rare plant,
a species of brome grass. Uses data in brome.txt.
- brome2.sas Analysis of multiple Latin
Squares, using made-up data based on the brome grass study.
- blockex2.sas Analysis of block
design using random blocks. Data is mead53.txt (one row per
observation), just as above.
- blocks2.sas Plot observations
against block means. Use of residual plots in block designs.
Illustration of log transformation and
multiplicative blocks. Uses data in multblock.txt
- Food.sas 1 way ANOVA using proc glm
- food2.sas 2 way ANOVA, with means,
lsmeans, estimates, and slicing of interaction. Requires data in food2.txt.
- foodmeans.sas Plot an
interaction plot. That means: compute means for
each cell in a two-way factorial treatment design. Plot means
against levels of one of the two factors, labeling points by the
value of the second factor.
- alfalfacut.sas Analysis of
alfalfa cutting experiment used as class example of a split plot
study. Requires data in alfalfacut.txt
- asparagus.sas Analysis of
balanced repeated measures. Illustrates one variable at a time,
summary statistics and MANOVA approach. Requires data in asparagus.txt.
- asparagus2.sas Analysis of
repeated measures by modeling the correlation structure in proc
mixed. Illustrates split-plot in time
analysis, AR(1), AR(1)+RE and other correlation models using mixed.
Requires data in asparagus.txt.
- asparagus3.sas Optional SAS
macro for fitting many different correlation structures and
reporting fit measures (AIC, AICc, and BIC) for correlation structure.
- trigly.sas Analysis of
triglyceride study used as example of multi-location/multi-year
Requires data in trigly.txt
- camp.sas Analysis of covariance
for data with baseline values. Requires data in camp.txt
Extra SAS programs that could be useful:
- excel.sas Examples of various ways
to read data from an excel spreadsheet into SAS.
- calfshape.sas SAS program to
reshape data by transposing it.
- Plan.sas SAS code to randomly assign
treatments to experimental units, in a CRD and in a RCB
- Plan2.sas SAS code to randomly assign
treatments. Produces much nicer output than plan.sas
- spatialwheat.sas Analysis of
spatial data using a spatial correlation model. Requires data in alliance.txt.