Intermediate and Advanced SAS® Macros
Steven First, Katie Ronk, Systems Seminar Consultants, Madison, WI Abstract
This hands-on workshop presents some intermediate-to-advanced macro topics such as macro referencing environments, macro interfaces (SYMGET, SYMPUT, EXECUTE, RESOLVE, PROC SQL), macro quoting, and macro functions. Good practices and alternatives to macros are also discussed. After a short lecture, attendees will perform hands-on exercises until the end of the session.
The SAS® programming language has a rich toolbox of features that can offer a lot of power to the user. The SAS macro language can be used to generate and alter SAS code. By combining these two languages the user can create some very dynamic systems. Combining these two languages can be daunting however. This workshop will concentrate on the interfaces available between the SAS macro language and other system components.
SAS Macro Overview
SAS macros construct input for the SAS compiler. Some functions of the SAS macro processor are to pass symbolic values between SAS statements and steps, to establish default symbolic values, to conditionally execute SAS steps, and to invoke very long, complex code in a quick, short way. It should be noted that the macro processor is the SAS system module that processes macros and the SAS macro languages is how you communicate with the processor. Without macros it is not easy to substitute variable text in statements such as TITLEs, to communicate across SAS steps, to establish default values, and to conditionally execute SAS step. Macros can do this and also hide complex code that can be invoked easily. Without macros, SAS programs are DATA and PROC steps that are scanned one statement at a time looking for the beginning of step (step boundary). When the beginning of step is found, all statements in the step are compiled and
this continues until when the end of step is found...
Please join StudyMode to read the full document