There are two distinct types of SAS macros: Clear understanding of this difference is the key to becoming a successful SAS programmer. In this analogy meal=code, cooking=SAS macro language, eating=SAS programming language. The difference between them is like a difference between cooking a meal and eating the meal. SAS macro language (comprised of %LET, %IF, %DO, macro functions etc.) which is processed separately from and before SAS compiler executes SAS programming language code.SAS programming language (comprised of DATA steps, PROC steps and global statements such as LIBNAME, OPTIONS, TITLE etc.).In other words, SAS code is a combination of two distinct languages: SAS programming languageĪ SAS program usually consists of two, often interwoven layers – macro layer and non-macro layer, each with its own syntax and its own timing of compilation and execution. If found, SAS software activates macro processor which resolves and substitutes those macro references according to the macro language syntax before SAS compiles and executes your programming steps. Generally, SAS software processes your SAS program step by step, first scanning it for macro language objects - macro variables referenced as &somename, and macros referenced as %somename. Related blog post: Multi-purpose macro function for getting information about data sets Macro language and macro processor It allows SAS users to modularize programming code with “once written – many times used” components, and in many cases automatically generate data-driven SAS code. SAS® Macro Language immensely empowers SAS programmers with versatility and efficiency of their code development.
0 Comments
Leave a Reply. |