Macro Programming

£155.00 (incl. VAT):
Order
Contact us
Please read our Terms and Conditions and our Privacy Policy.
 

Duration: Approximately 12-15 hours (plus additional time for exercises).

Learning Overview

This Learning Pathway will provide you with the knowledge, tools and techniques to enhance your code and which you can apply in a wide range of settings to make your programs smarter. Learn how to write flexible and efficient code using macro variables and functions. 

There are mini quizzes and comprehensive exercises throughout to help assess and reinforce your learning.

Learning Outcomes

By the end of this pathway you will be able to:
  1. Explain the introductory elements and concepts of the Language of SAS.
  2. Describe ten fundamental Programming Concepts within the Language of SAS.
  3. Describe how macro variables and macro functions can be used to help you write more efficient code in the Language of SAS

Pre-requisites

This learning pathway is aimed at those who are new to the Language of SAS.

You should already have:

  • Knowledge of your computer system
  • Basic computer literacy
  • Some previous programming experience, although this is not essential

For the hands-on practice activities you will need access to an environment that runs the programming Language of SAS. On our courses, we signpost you to some of the free tools available. 

Check out the link below to review system requirements:

Learning Modules

Introduction to SAS Programming

Learning Objective: Explain what the Language of SAS is used for and by whom.

  • Explanation about SAS and who uses it
  • Data Access
  • Data Management
  • Data Analysis
  • Data Presentation

Basic Concepts

Learning Objective: Explain how the Language of SAS is used to access, manage, analyse and present data.

  • What is a dataset, a database and a relational database?
  • Libraries, LIBREFS, LIBNAME statement
  • Referencing a dataset
  • The Data Step procedure
  • Basic Procedures including PROC MEANS and PROC PRINT

Investigating SAS datasets

Learning Objective: Define how to investigate datasets in the Language of SAS using two types of Procedure.

  • The PRINT procedure
  • Metadata, the CONTENTS procedure
  • Types of data

Programming Concepts

Learning Objective: Describe the key programming concepts within the Language of SAS.

  • Program components – Data Steps and Procedures
  • Programming language is made up of statements, expressions, functions & call routines, options, formats, and informats
  • Managing Syntax errors
  • Naming conventions

Data Step Processing

Learning Objective: Explain how the two phases of Data Step Processing work to create new datasets and variables.

  • Data Step syntax: The DATA and SET Statements
  • Creating Datasets
  • Creating Variables
  • Data Step processing, i.e. what goes on in the background when you submit your data step code.

Selecting Variables and Observations

Learning Objective: Define Variables and Observations to be read from and written to datasets.

  • KEEPing and DROPing Variables
  • The IF Statement
  • The WHERE Statement
  • FIRSTOBS= and OBS=
  • IS NULL or IS MISSING
  • BETWEEN-AND
  • CONTAINS (?) and SOUNDS LIKE (=*)

Character Functions

Learning Objective: Describe how functions are used to perform character transformation including:

SUBSTR, SCAN, TRIM, COMPRESS, LEFT, RIGHT, CATX, INDEX, FIND, UPCASE, LOWCASE, PROPCASE and TRANWRD

Numeric Functions

Learning Objective: Describe how functions are used to perform numeric transformation including:

SUM, MEAN, MIN, MAX, ROUND, CEIL, FLOOR, INT 

Date Functions

Learning Objective: Describe how functions are used to perform date transformation including:

TODAY, DATE, MDY, DAY, MONTH, YEAR, WEEKDAY, QTR, TIME / DATETIME, TIMEPART / DATEPART, INTCK / INTNX, YRDIF / DATDIF

Introduction to Macro processing

Learning Objective: Explain basic Macro Processing in the Language of SAS.

  • Compilation and Execution phases
  • Tokenization
  • Macro Triggers
  • The %PUT Statement
  • Displaying macro variable values

Introduction to Macro variables

Learning Objective: Describe six different features of Macro Variables.

  • Macro Variable Storage
  • Macro Variable Resolution
  • User-Defined Macro Variables
  • The %LET Statement
  • The SYMBOLGEN Option
  • Delimiting Macro Variables

Macro Functions

Learning Objective: Identify three different types of Macro Functions.

  • Character Functions – review
  • Using Macro Functions
  • Macro Functions for Numbers
  • The %SYSFUNC and other functions including: %INDEX, %SCAN, %SUBSTR, %UPCASE, %BQUOTE, %STR, %NRBQUOTE, %NRSTR, %EVAL and % SYSEVALF.
 

Macro Programming (LP1)