_NEW_ Operator: PCRXFIND Package

Constructs an instance of a PCRXFIND package.

Note:The escape character ( \ ) before the bracket indicates that the bracket is required in the syntax.

Syntax

package-variable = _NEW_ PCRXFIND([expression]);

Required Argument

package-variable

specifies a name that can reference an instance of the package.

Optional Argument

expression

specifies a regular expression used to operate on the input text.

Details

A DS2 package is a collection of variables and methods of which particular instances can be constructed and used in other DS2 programs.

You declare a PCRXFIND package variable using the DECLARE PACKAGE statement. After you declare a PCRXFIND package variable, use the _NEW_ operator to instantiate an instance of the PCRXFIND package and assign the new package instance to the PCRXFIND package variable.

declare package PCRXFIND finder;
finder = _new_ PCRXFIND();

As an alternative to the two-step process of using the DECLARE PACKAGE and the _NEW_ operator to declare and instantiate a logger package, you can declare and instantiate the package in one step by using the DECLARE PACKAGE statement as a constructor method. Here is the same example using only the DECLARE PACKAGE statement.

declare package PCRXFIND finder();
Note: Package variables are subject to all variable scoping rules. For more information, see Packages, Scope, and Lifetime in SAS DS2 Programmer’s Guide.

See Also

Last updated: August 14, 2026