Conditionally Executing Data Steps and Statements Based on the Presence of Variables in a SAS® Dataset, SESUG Paper 190-2019

Written by:
Working Paper Number: SESUG Paper 190-2019

Abstract

Sometimes a data step should only be executed if one or more variables are present in the input dataset. The same is true of statements within data steps. This paper provides several macros to detect the presence of variables and counts of the present variables. Examples show how these macros can be used to accomplish conditional execution for many scenarios. These macros have the advantage of only using macro statements, thus avoiding the costs of opening datasets.

Page Last Revised - August 27, 2024