STAT 440 Lecture 10: Macro Programs
Document Summary
Macro is a group of sas statements that is referred by a name and to use it in program anywhere, using that name. It starts with a %macro statement and ends with %mend statement. The local variables are declared with below syntax. The below program declares a group of sat statements under a macro named "show_result"; This macro is being called by other sas statements. Sas has many macro statements which are in-built in the sas programming language. They are used by other sas programs without explicitly declaring them. common examples are - terminating a program when some condition is met or capturing the runtime value of a variable in the program log. This macro statement writes text or macro variable information to the sas log. In the below example the value of the variable "today" is written to the program log. Execution of this macro causes normal termination of the currently executing macro when certain condition evaluates to be true.