col Function (GPL)

Syntax

col(source(<source name>), name("variable name"), <type>, <function>)

<source name>. A data source previously defined by a SOURCE statement.

"variable name". The name of the variable in the data source.

<type>. A data type or measurement level. If no type is specified, the variable is assumed to be continuous.

<function>. One or more valid functions. These are optional.

Description

Extracts a column of data from a data source. This is used for creating variables from the data.

Examples

Figure 1. Example: Specifying a continuous variable from a data source
DATA: age = col(source(mydata), name("age"))
Figure 2. Example: Specifying a categorical variable from a data source
DATA: gender = col(source(mydata), name("gender"), unit.category())
Figure 3. Example: Specifying a date variable from a data source
DATA: date = col(source(mydata), name("date"), unit.time(), format("M/d/yyyy"))

Valid Types

unit.category. Specifies a categorical variable.

unit.time. Specifies a date variable. You will often need to specify the date format if using this type. Note: In IBM® SPSS® Statistics, dates from a userSource are passed to GPL as numeric values and are specified as continuous variables. Therefore, you should not use this type with a userSource.See the topic format Function (GPL) for more information.