Chapter Contents

Previous

Next
SAS Macro Language: Reference

Other Features of the Macro Language

Although subsequent chapters go into far more detail on the various elements of the macro language, this section highlights some of the possibilities, with pointers to more information.

macro statements
This chapter has illustrated only a few of the macro statements, such as %MACRO and %IF-%THEN. Many other macro statements exist, some of which are valid in open code, while others are valid only in macro definitions. For a complete list of macro statements, refer to "Macro Statements" in Chapter 12, "Macro Language Elements."

macro functions
Macro functions are functions defined by the macro facility. They process one or more arguments and produce a result. For example, the %SUBSTR function creates a substring of another string, while the %UPCASE function converts characters to uppercase. A special category of macro functions, the macro quoting functions, mask special characters so they are not misinterpreted by the macro processor.

There are two special macro functions, %SYSFUNC and %QSYSFUNC, that provide access to SAS language functions or user-written functions generated with SAS/TOOLKIT. You can use %SYSFUNC and %QSYSFUNC with new functions in base SAS software to obtain the values of SAS host, base, or graphics options. These functions also enable you to open and close SAS data sets, test data set attributes, or read and write to external files. Another special function is %SYSEVALF, which allows your macros to perform floating-point arithmetic.

For a list of macro functions, refer to "Macro Functions" in Chapter 12. For a discussion of the macro quoting functions, refer to Chapter 7. For the syntax of calling selected base SAS functions with %SYSFUNC, refer to Appendix 3, "Syntax for Selected SAS Functions Used with the %SYSFUNC Function."

autocall macros
Autocall macros are macros defined by the SAS System that perform common tasks, such as trimming leading or trailing blanks from a macro variable's value or returning the data type of a value. For a list of autocall macros, refer to "Autocall Macros Provided with SAS Software" in Chapter 12.

automatic macro variables
Automatic macro variables are macro variables created by the macro processor. For example, SYSDATE contains the date SAS is invoked. See Chapter 12 for a list of automatic macro variables, and Chapter 13 for a description of these automatic macro variables.

macro facility interfaces
Interfaces with the macro facility provide a dynamic connection between the macro facility and other parts of the SAS System, such as the DATA step, SCL code, the SQL procedure, and SAS/CONNECT software. For example, you can create macro variables based on values within the DATA step using CALL SYMPUT and retrieve the value of a macro variable stored on a remote host using the %SYSRPUT macro statement. For more information on these interfaces, refer to Chapter 8, "Interfaces with the Macro Facility."


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.