Previous Page | Next Page

Component Objects

Dot Notation and DATA Step Component Objects


Definition

Dot notation provides a shortcut for invoking methods and for setting and querying attribute values. Using dot notation makes your SAS programs easier to read.

To use dot notation with a DATA step component object, you must declare and instantiate the component object by using either the DECLARE statement by itself or the DECLARE statement and the _NEW_ operator together. For more information about creating the hash, hash iterator, and java DATA step component objects, see Using DATA Step Component Objects in SAS Language Reference: Concepts. For more information about creating the logger and appender objects, see Logger and Appender Object Language Reference in SAS Logging: Configuration and Programming Reference.


Syntax

The syntax for dot notation is as follows:

object.attribute

or

object.method(<argument_tag-1: value-1<, ...argument_tag-n: value-n>>);

Where

object

specifies the variable name for the DATA step component object

attribute

specifies an object attribute to assign or query.

When you set an attribute for an object, the code takes this form:

object.attribute = value;

When you query an object attribute, the code takes this form:

value = object.attribute;
method

specifies the name of the method to invoke.

argument_tag

identifies the arguments that are passed to the method. Enclose the argument tag in parentheses. The parentheses are required whether the method contains argument tags.

All DATA step component object methods take this form:

return_code=object.method(<argument_tag-1:value-1<, ...argument_tag-n value-n>>);

The return code indicates method success or failure. A return code of zero indicates success; a non-zero value indicates failure. If you do not supply a return code variable for the method call and the method fails, an appropriate error message will be printed to the log.

value

specifies the argument value.

Previous Page | Next Page | Top of Page