DATA Statement (GPL)

Note: Starting with IBM® SPSS® Statistics 28.0.1, GPL DATA statements are optional.

Syntax

DATA: <variable name> = <function>

<variable name>. User-defined name for the variable. Refer to GPL Syntax Rules for information about which characters you can use in the name.

<function>. A function indicating the data sources.

Description

Defines a variable from a specific data source. The GPL statement must also include a SOURCE statement. The name identified by the SOURCE statement is used in the DATA statement to indicate the data source from which a particular variable is extracted.

Examples

Figure 1. Example: Specifying a variable from a data source
DATA: age = col(source(mydata), name("age"))

age is an arbitrary name. In this example, the variable name is the same as the name that appears in the data source. Using the same name avoids confusion. The col function takes a data source and data source variable name as its arguments. Note that the data source name was previously defined by a SOURCE statement and is not enclosed in quotes.