Example SAS programs

SAS programs that have been discussed in lab (or in class) are included here.

Programs from Lab on 22 Aug 2012

  • Tomato.sas Data step with infile for external data, descriptive statistics, plots, 2 sample t-test

    Programs from Lab on 28 Aug 2012

  • Clearing Results Viewer Blog post on how to clear the results viewer window, and how to assign that bit of code to a key or toolbar button.
  • readdata.sas Code to read data into SAS in various ways
  • tomrand.sas Code to do a two-sample randomization test using PROC NPAR1WAY with SCORES=DATA.
  • tomt.sas Code to do a two sample t-test using PROC TTEST.

    Programs from Lab on 5 Sept 2012

  • Pairedt.sas Code to do a paired t test in either PROC MEANS or PROC UNIVARIATE. PROC MEANS also computes confidence interval for mean difference. PROC UNIVARIATE also computes the nonparametric sign and Wilcoxon signed rank tests.
  • Transf.sas Code to transform variables and construct a residual plot using proc glm.

    Program from lecture on 10 Sept 2012

  • Hamburger.sas Code to do nonparametric 2 sample test (Wilcoxon rank sum test).

    Programs from Lab on 19 Sept 2011

  • diet1.sas Code to calculate the ANOVA table, calculate group means, and test linear combinations of means.
  • tobeave.sas Full set of code illustrating calculating averages, then transforming those averages.
  • Programs from lab on 26 Sept 2012

  • Dietint.sas Code to set up and fit intermediate models.
  • Diet2.sas Continuation of 'After the ANOVA' analyses: multiple comparisons and false discovery rate.

    Programs from lab on 3 Oct 2012

  • meat1.sas Linear regression using proc glm or proc reg. Estimating slope and intercept.

    Programs from after lecture on 8 Oct 2012

  • levene.sas Program to implement Levene's test of equal variances
  • Programs from Lab on 10 Oct 2012

  • meat2.sas More options for linear regression using proc glm. Calculating predicted values, se's and se_pred's, ci's and prediction intervals. More things to add to a plot using sgplot.

    Programs from Lab on 17 Oct 2012

  • meat3.sas Confidence intervals on parameters, ANOVA lack of fit tests
  • p-values.sas Using SAS to compute two-sided p-values from T statistics, p-values from F statistics, and quantiles of a T distribution.
  • brain.sas Multiple linear regression using PROC GLM and PROC REG.

    Programs from Lab on 24 Oct 2012

  • light2.sas Constructing indicator variables. Fitting multiple regression models. Note: Uses light.txt data file.
  • anscombe2.sas Calculating and plotting Cook's distance in proc reg. Note: Uses anscombe.txt data file.
  • corn.sas (Posted but not discussed). Analysis of the corn yield / rainfall data discussed in the 24 Oct lecture. Calculating polynomial terms. Fitting multiple regression models.

    Programs from before lab on 31 Oct 2012

  • Light3.sas Plotting means with +/- se bars

    Programs from Lab on 31 Oct 2012

  • sat.sas Model selection in proc reg and proc glmselect. Uses sat.txt data file.

    Programs from Lab on 7 Nov 2012

  • collard.sas

    Programs from Lab on 14 Nov 2012

  • pygmalion.sas ANOVA for randomized complete block design
  • vitc.sas Contingency table analysis, using Vitamin C data set, included with the program

    Program from lab on 28 Nov 2012

  • macro.sas Various potentially useful things you can do with SAS

    Programs from Lab on 5 Dec 2012

  • donner.sas Logistic regression, using the Donner party data.
  • vitc2.sas event/trials syntax, adjusting for overdispersion
  • matings.sas Poisson regression for counts