SAS Institute. The Power to Know

SAS(R) 9.2 Macro Language: Reference

Previous Page | Next Page

Macro Expressions

Introduction to Macro Expressions

There are three types of macro expressions: text, logical, and arithmetic. A text expression is any combination of text, macro variables, macro functions, or macro calls. Text expressions are resolved to generate text. Here are some examples of text expressions:

  • &BEGIN

  • %GETLINE

  • &PREFIX.PART&SUFFIX

  • %UPCASE(&ANSWER)

Logical expressions and arithmetic expressions are sequences of operators and operands forming sets of instructions that are evaluated to produce a result. An arithmetic expression contains an arithmetic operator. A logical expression contains a logical operator. The following table shows examples of simple arithmetic and logical expressions:

Arithmetic Expressions Logical expressions
1 + 2 &DAY = FRIDAY
4 * 3 A < a
4 / 2 1 < &INDEX
00FFx - 003Ax &START NE &END

Previous Page | Next Page | Top of Page