Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 10. Macro Programming > 10.4 Macro Variables, Parameters, and Functions

10.4 Macro Variables, Parameters, and Functions

A macro variable can be referenced anywhere in a SAS program. (The only exception is in data lines that are being read into SAS.) A macro variable can be assigned text values. The value of a variable is stored in either a local or global symbol table. A macro variable name must be a valid SAS name. (#$#%@#$%#!! won't work, even though you might feel this way about a programming project.) A macro variable is preceded by an & when it is referenced in a SAS program. When a macro variable is resolved in a program, it might be closely associated with text. If it follows text, then it is referenced as text&macro-variable. If it precedes text, then it is referenced with a period delimiting the value from the text (&macro-variable.text). SAS can define certain macro variables (automatic macro variables), while a program can define other macro variables (userdefined macro variables.)

When you first start macro programming in SAS, you will most likely use macro variables to define simple substitutions in a program. In Display 10.5, the trapezoidal numerical integration routine is modified to address the previous questions.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial