Crosstab Example
The Crosstab option is best explained using an example. Consider the following matrix of information, where the first row contains column names:
Product | Time | Measurements |
A | 1/1/9911:00 AM | 1.2 |
A | 1/1/9911:05 AM | 1.1 |
B | 1/1/9911:00 AM | 1.4 |
B | 1/1/9911:05 AM | 1.2 |
A | 1/1/9911:07 AM | 1.3 |
A | 1/1/9911:09 AM | 1.5 |
B | 1/1/9911:07 AM | 1.5 |
B | 1/1/9911:09 AM | 1.1 |
If the above matrix is a subset of records from a table in a database, it may be useful to create a query that returns a set of two columns, containing the observed measurements for products A and B, with the unique values of timestamps defining the rows. To accomplish this task, a crosstab query is defined. Three selections are available from the Crosstab drop-down list box:
In the example above, specifying Product as a Crosstab Column, Time as a Crosstab Row, and Measurements as a Crosstab Value will return the following recordset:
Time | A | B |
1/1/99 11:00 AM | 1.2 | 1.4 |
1/1/99 11:05 AM | 1.1 | 1.2 |
1/1/99 11:07 AM | 1.3 | 1.5 |
1/1/99 11:09 AM | 1.5 | 1.1 |
Note. Special keywords are available for SQL statements related to crosstab queries. See the Special SQL Keywords topic for information about available keywords that may be used in the SQL statements in STATISTICA Enterprise.