Skip to main content

Instructor-led training

SAS Macro Programming

SAS training from Hartmann Software Group, delivered onsite or live online.

What you'll learn

The SAS Macro Programming course is intended for intermediate or experienced SAS users in programming roles. This course covers writing macro programs, techniques and tips. Learn to write SAS macro programs fast and efficiently.
 
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)

Prerequisites

Before attending this course, you need to be able to do the following: Write simple SQL queries using the SELECT statement. Read from and write to SAS tables using a DATA step. Use DATA step programming statements, including IF-THEN/ELSE, DO WHILE, DO UNTIL, and iterative DO. Use character functions such as SUBSTR. Filter data using the WHERE statement. Use SAS procedures such as SORT and PRINT.

Course Outline

  • Introduction
    • Review common functionality from SAS Programming Essentials course.
    • Describe the two components of the SAS Macro Facility.
    • List the three tips to making your SAS macro code easier to debug.
  • Macro Processing Mechanics
    • List the different types of tokens.
    • Describe how a SAS program is processed.
    • List the macro triggers.
    • Describe how a SAS program is processed with macro triggers.
  • Macro Variables
    • List the two different types of macro variables.
    • Display the automatic macro variables.
    • Use an automatic macro variable.
    • Create a user-defined macro variable with a %LET statement.
    • Use a user-defined macro variable.
  • Macro Programs
    • Describe the purpose of a macro program.
    • Differentiate between compile and execution of a macro program.
    • Create a macro definition.
    • Call a macro.
    • Debug with MPRINT and MLOGIC options.
    • Make a macro more dynamic with parameters.
  • Macro Symbol Tables, Compilation, and Execution
    • Describe where macro variables are stored.
    • Differentiate between the Global and Local symbol tables.
    • Describe where macro programs are stored.
  • Storing and Reusing Macros
    • Store compiled Macro programs in a permanent SAS library.
    • Store uncompiled Macro programs and make them always accessible to your program.
  • Macro Language Functions
    • Use macro character functions.
    • Use macro evaluation functions.
    • Call a SAS supplied autocall macro.
    • Mimic a SAS function using %SYSFUNC.
  • Macro Flow Control Statements
    • Conditionally submit code to the SAS compiler.
    • Repetitively submit code to the SAS compiler.
  • Interfaces to the Macro Facility
    • Create macro variables from data using CALL SYMPUTX.
    • Create macro variables from data using PROC SQL.
  • Indirect References to Macro Variables
    • Use multiple ampersands for indirect references to macro variables.
  • Masking Special Characters
    • Describe why you would need macro quoting functions.
    • Use macro quoting functions.

Train your team with HSG

Private, instructor-led training customized for your organization.

  • Onsite or live online delivery
  • Customized curriculum
  • Training for groups of 3 or more
  • Flexible scheduling
  • Experienced instructors
Request a Training Proposal

Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com

Ready to train your team?

Let's customize this training for your organization.

Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.