LOOKUP

Function

Searches a lookup table (an array) for a key value and returns the corresponding text string.

Syntax

LOOKUP lookup_table_name {key_any_lit|_var|_col}
{ret_txt_var|_date|_var}

Arguments

lookup_table_name

Name of the lookup table. This table must be previously loaded with LOAD-LOOKUP.

key_any_lit|_var|_col

Key used for the lookup.

ret_txt_var|_date|_var

String variable into which to return the corresponding value.

Description

Speeds up processing for long reports. For example, to print the entire state name rather than the abbreviation, use LOAD‑LOOKUP followed by LOOKUP.

Examples

The following example works in conjunction with the example for LOAD-LOOKUP:

lookup  states  &state_abbr  $state_name

This example searches the states lookup table for a matching &state_abbr value; if found, it returns the corresponding state name in $state_name. If not found, a null is placed in $state_name.

See Also

LOAD‑LOOKUP