SAS Seminar

Spring Semester 2006

Instructor: John Borkowski
Meeting: Tuesday 3:10--4:00 in Wilson Computer Lab.

  • Introduction to SAS on UNIX.

    Data entry and manipulation methods.

  • Pages 1.1-1.2. File r1.sas. Reading data line by line and sequentially. Line comments. Proc Print.

  • Page 1.3. File r2.sas. Reading data from an external text data file "name.dat". Block comments.

  • Page 1.3. Data file "name.dat".

  • Pages 1.4-1.5. File r3.sas. Reading data using loops. Example 1: Oneway ANOVA data. Example 2: Creating repeated measurements from individual data records. Intro to arrays. More Proc Print.

  • Pages 1.6-1.7. File r4.sas. Combining data sets by (i) stacking and (ii) merging. Even more Proc Print.

  • Pages 1.8-1.9. File r5.sas. Libname statement. Reading in another external text data file. Creating SAS (formatted) data sets. Proc Contents. Reading in SAS data sets. Format statement.

  • Page 1.8. Data file "lowwgt.dat".

  • Pages 1.10. File r6.sas. Merging data sets by ordered observations but having no common variables.

  • Page 1.11. File r7.sas. Reading in data with multiple loops. Making a title.

  • Page 1.12. File r8.sas. Reading in unbalanced data from a twoway ANOVA.

  • Page 1.13-1.14. File dowjones.sas. Formatted date. Making multiple data sets in the DATA step. DROP, KEEP, and LABEL statements.

  • Pages 1.15-1.16. File put.sas. Customizing output from PROC PRINT using the PUT statement.

  • Pages 1.17. File read8.sas. Reading in comma separated data.

  • Page 1.17. Data file "read8.csv".

  • Pages 1.18. File read9.sas. Alternative method of reading in unbalanced data.

    SAS Functions/Language.

  • Pages 2.3-2.4. File function.sas. Several common SAS functions with one or more arguments.

  • Pages 2.5-2.6. File cdf.sas. Generating a binomial or hypergeomtric distribution table.

  • Pages 2.7-2.8. File srs.sas. How to take a simple random sample (with and without replacement) from a set of data.

  • Pages 2.9-2.14. File frstlst.sas. The FIRST and LAST statements.

    Common SAS PROCs.

  • Pages 3.1-3.4. File means.sas. Using PROC MEANS to standardize variables. Comaring output from PROC REG for regressions based on unscaled and scaled predictors.

  • Page 3.5. File freq.sas. Using PROC FREQ to make oneway and twoway contingency tables. Chi-square and Fisher's Exact Test for twoway tables.

  • Pages 3.6-3.10. File univar.sas. Using PROC FORMAT to reformat variables. Using PROC UNIVARIATE to generate summary statistics, tests of normality, and one-sample tests of location.

  • Pages 3.11-3.12. File pairedt.sas. Using PROC MEANS to perform a paired data t-test and a one-sample t-test.

  • Pages 3.13-3.14. File ttest.sas. Two-sample t-tests using PROC TTEST. Mann-Whitney-Wilcoxon Test using PROC NPAR1WAY. Simple plot using PROC PLOT.

  • Page 3.15. File standard.sas. Using PROC MEANS to standardize variables. Find the data entry mistake.

  • Pages 3.16-3.18. File corr.sas. Using PROC CORR to calculate Pearson's r, Spearman's rho, and Kendall's tau correlation coefficients (and associated tests of significance). Pearson partial correlation coefficients.

    ANOVA/Regression PROCs.

  • Pages 3.1-3.4. File means.sas. Using PROC MEANS to standardize variables. Comaring output from PROC REG for regressions based on unscaled and scaled predictors.

  • Pages 4.1-4.5. File twoway.sas. Output from PROC GLM for a twoway ANOVA including plots of residuals vs predicted values, residuals vs run order, and a normal probability plot.

  • Pages 4.6-4.7. File include.sas. Using %INCLUDE statements in PROC GLM. The following SAS code files are those files referenced in the %INLCUDE statements: (1) File predplot.sas. (2) File runplot.sas. (3) File normplot.sas.

  • Pages 4.8-4.17 File contrast.sas. Output from PROC GLM for an ANOVA having 3 fixed effects and a nested random effect. The RANDOM statement. CONTRAST and ESTIMATE statements.

    Plots and Graphical Displays.

  • Pages 6.1-6.4. File gplot1.sas. Introduction to PROC GPLOT. Fitting and graphing linear, quadratic, and cubic models.

  • Pages 6.5. File gplot2.sas. More PROC GPLOT options (JUSTIFY, SYMBOL, HAXIS, VAXIS, etc.)

  • Pages 6.6. File dow.sas. More PROC GPLOT options (AXIS statements, dates).

  • Pages 6.7. File beads.sas. More PROC GPLOT options.

  • Pages 7.1-7.7. File gchart.sas. Using PROC GCHART to make assorted bar charts.

  • File bison.sas. Using PROC GCHART to make segmented bar charts with two grouping factors.

  • File onefact.sas. Using PROC GPLOT to plot a function with highlighted points.

  • File contour.sas. Using PROC GPLOT to make a contour plot and a 3-dimensional plot.

  • File boxplots.sas. Using PROC GPLOT to make side-by-side boxplots.

  • File mix.sas. Using PROC GPLOT to overlay plots having different pairs of x and y variables.

    Other Statistical Methods/Problems.

  • Pages 8.1-8.10. File fitdist.sas. Using PROC CAPABILITY to fit different distributions to a data set.

  • Pages 8.11-8.12. File boot.sas. How to bootstrap the mean from a set of data.

  • Pages 9.1-9.11. File nlin.sas. Nonlinear least squares regression to fit nonlinear equations using PROC NLIN. Four examples from the SAS manual.

  • Pages 10.1-10.6. File logistic.sas. Stepwise logistic regression using PROC LOGISTIC (See SAS sample programs for logistic regression.)

    Practice Work.

  • Assignment 1: In each of the following SAS code files there is an error. Run the program, look at the log file, and determine where the error occurs. Fix the error and rerun the code. Make sure the log file no longer has any errors and you get the correct output.

  • (1) File fixit1.sas. (2) File fixit2.sas. (3) File fixit3.sas. (4) File fixit4.sas. (5) File fixit5.sas. (6) File fixit6.sas. (7) File fixit7.sas.

  • Assignment 2: Using the y data in --> pairedt.sas <--, test the null hypothesis Ho: mu(y) = 3 against the alternative that mu(y) does not equal 3. Perform the test using alpha=.01.

  • File prob1.sas. Homework problem 1.

  • File prob2.sas. Homework problem 2.

  • File prob3.sas. Homework problem 3.