Welcome to STAT 540, Introduction to Statistical Computing. This page contains updates to the course syllabus, computer notes from class, homework assignments and important notices. Send any questions to grego@stat.sc.edu

- 2020 Syllabus
- Uploading assignments in Blackboard
- Base SAS Certification app
- Notices
- Exercises
- Class Exercise 1 and R markdown code
- Class Exercise 2 , data set , and R markdown code
- Class Exercise 3 , and R markdown code
- Class Exercise 4 , R workspace and R markdown code
- Class Exercise 5 , R workspace and R markdown code
- Class Exercise 6: Studio version and SAS program
- Class Exercise 7
- Class Exercise 8
- Class Exercise 9 and Excel worksheet
- Class Exercise 10

- Class Exercise 1 and R markdown code
- Slides/Notes
- Introduction, R Chapters 1 and 2 (Introduction; Objects, Modes, Assignments)
- R Chapters 3 through 6 (Getting Help; Managing Your Objects; Getting Data into R; Getting Results out of R)
- R Chapters 7 through 8 (Arithmetic; Logical Objects and Conditional Execution)
- R Chapters 9 through 10 (Subsetting, Sorting and so on...; Iteration)
- R Chapter 11 (An Introduction to Graphics in R)
- R Chapter 12 (An Introduction to Function Writing)
- Monte Carlo simulation
- tidyverse Intro
- Scatterplot Smoothing (not currently used)
- SAS Chapter 1 (Getting Started Using SAS Software)
- SAS Chapter 2 (Getting Your Data into SAS)
- SAS Chapter 3 (Working with Your Data)
- SAS Chapter 4 (Sorting, Printing, and Summarizing Your Data)
- SAS Chapter 6 (Modifying and Combining SAS Data Sets)
- SAS Chapter 5 (Enhancing Your Output with ODS)
- SAS Chapter 7 (Writing Flexible Code with the SAS Macro Facility)
- SAS Chapters 5 and 7 supplement (PROC TEMPLATE, ODS Graphics and Macro application)
- SAS Chapter 8 (ODS Graphics)
- SAS Chapter 10 and Appendices (SQL)

- Introduction, R Chapters 1 and 2 (Introduction; Objects, Modes, Assignments)
- SAS code and notes
- SAS documentation
- Chapter 1 code
- Weather station code for Chapter 1 notes and Exercise 6.

- Weather station code for Chapter 1 notes and Exercise 6.
- Chapter 2 code
- Excel spreadsheet and SAS PROC IMPORT code for Chapter 2 import demonstration.
- SAS code for saving a permanent SAS data set directly to a directory
- SAS code for importing an Excel file two ways, including the XLSX option in LIBNAME
- SAS code for importing a comma-delimited file
- Exported comma-delimited file for July 15 state-level COVID-19 statistics
- Exported comma-delimited file for cumulative daily COVID-19 confirmed cases
- Excel version of July 15 state-level COVID-19 statistics
- SAS code for holding an input line for a conditional execution of the rest of the input.
- Additional SAS code for holding an input line for a conditional execution of the rest of the input.
- SAS code with a variety of informats.
- SAS code and input file for reading a long record. Additional input file for long record with line breaks.
- David Hitchcock's SAS code and text file for reading in a college football scores data set.

- Excel spreadsheet and SAS PROC IMPORT code for Chapter 2 import demonstration.
- Chapter 3 code
- SAS code to manipulate character data.
- SAS code to demonstrate a simple IF statement, subsetting IF, and formatted PRINT.
- SAS code with a complicated IF-ELSE example.
- SAS code to demonstrate a subsetting IF.
- SAS code to experiment with DATE functions.
- David Hitchcock's SAS code demonstrating the use of the RETAIN statement using earthquake data.
- SAS code using SET and OUTPUT to stack records in a SAS data set.
- SAS code with an ARRAY example.
- SAS code to refer to a range of "unlike" input variables.
- SAS code demonstrating variable order for a simple data set.

- SAS code to manipulate character data.
- Chapter 4 code
- SAS code to demonstrate Chapter 4 commands (TITLE, WHERE, LABEL, PROC PRINT)
- SAS code and SAS data set for a PROC SORT example.
- SAS code and comma-delimited text file demonstrating the use of the NODUPKEY option in PROC SORT.
- SAS code to demonstrate PROC MEANS and OUTPUT statement using Southeast COVID SAS data set
- SAS code with a PROC SORT example that cleans up a PROC MEANS output file in preparation for a many-to-one merge.
- SAS code to demonstrate sorting options with character variables.
- SAS code to hold a data line and print formatted labels in PROC FREQ.
- SAS code to group data with PROC FORMAT prior to a call to PROC FREQ.
- Simplified version of Don Edwards' SAS code and data set for straightforward PROC TABULATE call to motivate interest in PROC TABULATE projects.

- SAS code to demonstrate Chapter 4 commands (TITLE, WHERE, LABEL, PROC PRINT)
- Chapter 6 code
- SAS code for some simple set and merge commands.
- SAS code for a typical match-merge.
- SAS code for a match-merge with multiple input data sets.
- SAS code for a one-to-many match-merge.
- STAT 706 example SAS code and Excel data for several one-to-many match-merges. The Excel file may be read into WORK as SAS data set SPLITCOV.
- SAS code demonstrating the IN= option in MERGE statements.
- SAS code and SAS data set to generate multiple data sets with the OUTPUT statement.
- PROC TRANSPOSE SAS code using visual acuity data.
- SAS code to re-create the transposed data with another PROC TRANSPOSE.
- SAS code using Lidar data set to demonstrate use of FIRST.variable and LAST.variable when using BY groups.

- SAS code for some simple set and merge commands.
- Chapter 5 code
- SAS code to create PDF documents by graphing Broad River data .
- SAS code and data set demonstrating use of ODS HTML.
- SAS code demonstrating use of ODS TRACE and ODS SELECT.

- SAS code to create PDF documents by graphing Broad River data .
- Chapter 7 code
- SAS code for a couple demonstrations of the %LET command .
- SAS code demonstrating the use of %INCLUDE.
- SAS code demonstrating calculation of sampling probabilities from traffic intensity (upurban.csv) data.
- SAS code demonstrating a regression macro.
- SAS code demonstrating CALL SYMPUTX and a non-macro language alternative.
- SAS code demonstrating CALL SYMPUTX and %IF statements. Trial data sets with one , two and four groups.
- SAS code demonstrating CALL SYMPUTX to simplify the sampling probabilities macro.
- SAS code and Excel spreadsheet to demonstrate templates and ODS Graphics.
- SAS code to edit template definitions.

- SAS code for a couple demonstrations of the %LET command .
- Chapter 8 code
- SAS code and Excel worksheet to construct bar charts with PROC SGPLOT.
- SAS code to construct histograms and box plots with PROC SGPLOT.
- R code for density estimation demonstration.
- SAS code and one of the data sets needed to construct scatter plots, time series plots, and smoothed scatter plots with PROC SGPLOT and PROC SGPANEL.
- SC COVID comma-delimited data file to demonstrate SGPLOT
- R code for scatterplot smoothing demonstration.

- SAS code and Excel worksheet to construct bar charts with PROC SGPLOT.
- Chapter 10 and Supplemental SAS code
- SAS code to export SAS data sets.
- SAS code , SPSS portable format , SPSS data set , with Data View , Variable View , and Value dialog box screen captures.
- SAS code for COVID data cleaning.
- SAS code for basic SQL commands , SQL subsetting , SQL table joins , and SQL editing.

- SAS code to export SAS data sets.

- SAS documentation
- R code and notes
- Don Edward's R primer
- A first R session
- Quick-R primer
- NY Singer data set for supplementary introductory demonstration
- Monarch data set
- Chapters 1-2 R code (Introduction; Objects, Modes, Assignments)
- Chapters 3-6 R code (Getting Help; Managing Your Objects; Getting Data into R; Getting Results out of R)
- Chapters 7-8 R code (Arithmetic; Logical Objects and Conditional Execution)
- Chapters 9-10 R code (Subsetting, Sorting and so on...; Iteration)
- Chapters 11-12 R code (Graphics; An Introduction to Function Writing)
- Don Edward's Two Sample Test code without function name and with function name
- Gamblers Ruin R code
- Hit or Miss Integration R code
- R code to compare Hit or Miss MC to Classic MC
- Monte Carlo Simulation R code
- tidyverse R code
- Scatterplot Smoothing R code (not currently used)

- Don Edward's R primer
- Data sets and other code
- RMarkdown document for downloading Johns Hopkins COVID-19 data and inputting to R
- R data set for cumulative daily SC COVID-19 deaths
- R data set for July 15 state-level COVID-19 statistics
- Brain to Body ratio data set, tab-delimited
- Brain to Body ratio data set, comma-delimited
- Brain to Body ratio data set with row names, tab-delimited
- Brain to Body ratio data set with no column names, tab-delimited
- Fixed width data set
- scan() demo data set
- Longleaf pine growth rings

- RMarkdown document for downloading Johns Hopkins COVID-19 data and inputting to R
- Test 1
- Test 2
- Final Exam
- Final Exam 2007 ; Problem 1, Week 1 ; Problem 1, Week 2 ; Problem 1, Week 3 ; Problem 1 File list ; Problem 3 data set ; Problem 4 data set .
- Final Exam 2009 ; Excel workbook with all problem sets.
- Final Exam 2011 ; Excel workbook with all problem sets; Plot 1 and Plot 2 for Q2.
- Final Exam 2013 ; Excel workbook with all problem sets; Plot 1 and Plot 2 for Q2.
- Final Exam 2017 ; Excel workbook with all problem sets; Plot 1 , Plot 2 and Plot 3 for Q2.
- Final Exam 2020 ; Excel workbook with all problem sets; Plot 1 and Plot 2 for Q3.

- Final Exam 2007 ; Problem 1, Week 1 ; Problem 1, Week 2 ; Problem 1, Week 3 ; Problem 1 File list ; Problem 3 data set ; Problem 4 data set .
- Project information

Return to Department of Statistics Home Page