Chapter 2: Object-Oriented Programming for SAS Programmers

Background and Definition

Dog Class

An Example of OOP

Moving Forward

Background and Definition

Object-oriented programming (OOP) is a programming style based on data structures that contain data in fields, which are commonly called attributes. There is also code in the form of procedures, which are commonly called methods. This combination of a data structure and code is called a class. An object is a particular instantiation of a class. All interaction with the data in an object and the program that created the object is controlled through the object’s methods.

Many explanations and definitions of OOP try to clarify the concept with a concrete example, such as a dog:

Dog Class

Attributes ...

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.