Building an Advanced SAS Macro Language Toolset with User-Developed Macro Functions (Hands-On)
Presented: Wednesday September 5, 2018, 8:00am-11:30am
Art Carpenter’s publications list includes five books, and numerous papers and posters presented at SAS Global Forum, SUGI, and other user group conferences. Art has been using SAS since 1977 and has served in various leadership positions in local, regional, national, and international user groups. He is a SAS Certified Advanced Professional Programmer, and through California Occidental Consultants teaches SAS courses and provides contract SAS programming support nationwide.
The development and use of the SAS macro language to create macro systems and macro applications requires the use of sophisticated tools that perform specific operations. Generally the most flexible of these tools will be user-written single-purpose macro functions. The creation of macro functions is not difficult, if you know the basic rules and understand the primary principles involved.
This hands-on tutorial will explore the fundamentals of building macro functions, their implementation through macro libraries, as well as the sources of information that allow these tools to work effectively and intelligently.
During the discussion of these examples a variety of side topics will be explored, which will include the use of SAS-supplied macro functions and statements.
Intended Audience: Intermediate
Tools Discussed: Base SAS
Prerequisite: This course is designed for the SAS user who is comfortable with the basic syntax and structure of the SAS macro language, and is familiar with the commonly used macro language statements and functions.
- Review of the use of the %SYSFUNC function and the %SYSCALL statement
- The use of DATA step functions in the SAS® macro language
- The creation and use of user defined macro functions
- Examples of simple one line macro functions
- Establishing and using autocall facility macro libraries
- Examine macro functions that:
- Return the current date
- Return a list for data set variables
- Determine whether or not a data set exists
- Determine whether or not one or more variables exist on a given data set
- Return the number of observations in a data set
- Create directories
- Read information from within a directory
- Retrieve physical locations of files, data sets, and executing programs