SAS Programming 2: Beyond the Basics

SAS Programming 2: Beyond the Basics Courseware (SASPRG2)

This course is for those who need to perform advanced data processing and manipulation, and create a variety of outputs. SAS Programming 2 builds on the concepts that are presented in the SAS Programming 1: Fundamentals course and is not appropriate for beginning SAS software users.

This course use data from the SASHELP library installed with the software. These courses can be taught

  • using SAS Version 9 or higher
  • any operating system (focus is either Windows or Linux/Unix. If using MVS you may need to modify as necessary)
  • any interface (SAS Enterprise Guide is the focus. If using SAS Studio or SAS Display Manager you may need to modify slightly as necessary)
  • your installation of SAS, or SAS On Demand for Academics (free version of SAS for learning purposes)


After completing this course students will be able to:

  • Understand and control DATA step processing
  • Create an accumulating column and process data in groups.
  • Manipulate data with functions.
  • Create custom formats.
  • Process repetitive code using DO loops.
  • Rotate data.
  • Use the Debug feature on DATA steps in SAS Enterprise Guide.
  • Make code flexible using simple macro facility techniques.
  • Join data using PROC SQL


  • Introduction
    • Explain course logistics.
    • Explain course overview.
    • Review SAS syntax.
  • Controlling Input and Output
    • Use the Delete, Output, and subsetting IF statements to control writing data.
    • Create multiple data sets in the same DATA step.
    • Use DROP and KEEP to control variables output.
    • Use FIRSTOBS and OBS to control observations input.
  • Manipulating Data with Functions
    • Review the purpose of functions.
    • Manipulate character data by changing the case, combining and extracting strings, and other data manipulation techniques.
    • Use summary functions in the DATA step.
    • Use SAS Date functions to manipulate SAS data variables and create SAS dates.
    • Convert a variable from one data type to another.
  • Summarizing Data
    • Create an accumulating total variable.
    • Accumulate totals for a group of data.
  • Processing Data Iteratively
    • Perform repetitive processing with DO-loops.
    • Describe SAS array processing.
    • Use SAS arrays.
  • Restructuring a Data Set
    • Rotate data with the DATA step.
    • Use the TRANSPOSE procedure.
  • Combining SAS Data Sets
    • Use the IN= option with match-merging in the DATA Step.
    • Join data using PROC SQL.
  • Creating User Defined Formats
    • Create a format using PROC FORMAT.
    • Use a created format.
  • Writing Flexible Code with the SAS Macro Facility
    • Use macro variables for text substitution.
    • Write simple macro definitions.
    • Supply parameters.
  • Enhancing Your Output
    • Describe the concepts of the Output Delivery System.
    • Create Text Output.
    • Create HTML Output.
    • Create RTF Output.
    • Create PDF Output.
  • Debugging Your SAS Programs
    • Use the DEBUG option.
    • Use the PUTLOG statement.

Required Prerequisites

You must have at least six months of experience writing SAS programs or have completed the SAS Programming 1: Fundamentals course and used SAS for at least one month. You need to be able to:

  • submit a SAS program
  • diagnose and correct syntax errors
  • examine descriptor and data portions of a SAS data set
  • access SAS data libraries
  • read and create SAS data sets
  • create variables
  • combine SAS data sets
  • use global statements
  • use labels and formats
  • filter observations

Useful Prerequisites

Before attending this course, it is useful to know the following:

  • create a simple report with PROC SQL