SAS Macro Language

Description

In this course, you learn advanced techniques within the DATA step and procedures to manipulate data.

Course Learning Objectives: (3+ per course)
“By the end of this course, a learner will be able to…”
● Perform text substitution in SAS code.
● Use macro variables and macro functions.
● Automate and customize the production of SAS code.
● Conditionally or iteratively construct SAS code.
● Write self-modifying, data-driven programs.

What you will learn

Introduction

In this module you’ll get an overview of this course and set up your practice files. Then you’ll explore macro programming and learn what the macro facility will enable you to do and why it can make your job as a SAS programmer easier.

SAS Macro Facility

In this module, you learn how SAS processes code behind the scenes. This is important because mastering the SAS macro facility is only possible if you understand how macro language elements impact this processing. You also learn how to create and use macro variables to dynamically modify text in a program.

Storing and Processing Text

In this module, you learn more about storing and processing text. You learn to use macro functions to manipulate text, and how to use both PROC SQL and the DATA step to create macro variables based on values read from your data. You also learn how to use indirect referencing to look up a macro variable’s value based on another macro variable.

Working with Macro Programs

In this module, you learn to write and call macro programs to generate SAS code based on input values. You also learn about macro variable scope – where macro variables are stored and how long they are available. Finally you learn about conditionally generating and processing code using macro IF/THEN statements, and iterative processing with macro DO loops.

What’s included