Chapter 5: Methods

Defining Methods

System-Defined Methods

User-Defined Methods

Recursion

Defining Methods

Methods are the home of executable DS2 code. Executable statements in DS2 look like executable statements in the DATA step. That is, you add, subtract, multiply, divide, and so on, the same way in both. The important difference in DS2 is that you can put code into logical groupings called methods.

Methods act like SAS functions. A method can take arguments (parameters) and return an answer (result). Like SAS functions, methods can be saved and used in other DS2 programs.

In DS2, there are two fundamental types of methods:

•   System-defined methods

•   User-defined methods

System-Defined Methods

Because all executable code resides in methods ...

Get The DS2 Procedure: SAS Programming Methods at Work now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.