DQEXTRACT Function

Returns an extracted character value.

Valid in: DATA step, PROC SQL, and SCL
Restriction: Always use the DQEXTTOKENGET function to retrieve tokens from extracted values. To extract tokens from values that do not contain delimiters, use the DQTOKEN function.
Requirement: If specified, the locale must be loaded into memory as part of the locale list.

Syntax

Required Arguments

extraction-string

the value that is extracted according to the specified extraction definition. The value must be the name of a character variable, or a character value in quotation marks. Also valid, an expression that evaluates to a variable name or quoted value.

extraction-definition

the name of the extraction definition. The definition must exist in the locale that is used.

Optional Argument

locale

specifies a character constant, variable, or expression that contains the locale name.

Default The first locale in the locale list. If no value is specified, the default locale is used.

Details

The DQEXTRACT function returns an extracted character value. The return value contains delimiters that identify the elements in the value that correspond to the tokens that are enabled by the extraction definition. The delimiters in the value allow functions such as DQEXTTOKENGET to access the elements in the value based on specified token names.

Example

The following example extracts the name of an individual. Then the DQEXTTOKENGET function returns the values of two of the tokens.
extValue=dqExtract('Mr. James Joseph Westly', 'NAME', 'ENUSA');
prefix=dqExtTokenGet(extValue, 'Name Prefix', 'NAME', 'ENUSA');
given=dqExtTokenGet(extValue, 'Given Name', 'NAME', 'ENUSA');
After these function calls, the value of PREFIX is Mr. and the value of GIVEN is James.