Crosstable

The crosstable prefix is used to turn a cross table into a straight table, that is, a wide table with many columns is turned into a tall table, with the column headings being placed into a single attribute column.

Syntax:  

crosstable (attribute field name, data field name [ , n ] ) ( loadstatement | selectstatement )

Arguments:  

Argument Description
attribute field name The field that contains the attribute values.
data field name

The field that contains the data values.

n

The number of qualifier fields preceding the table to be transformed to generic form. Default is 1.

A crosstable is a common type of table featuring a matrix of values between two or more orthogonal lists of header data, of which one is used as column headers. A typical example could be to have one column per month. The result of the crosstable prefix is that the column headers (for example month names) will be stored in one field, the attribute field, and the column data (month numbers) will be stored in a second field: the data field.

Examples:  

Crosstable (Month, Sales) LOAD * from ex1.csv;

Crosstable (Month,Sales,2) LOAD * from ex2.csv;

Crosstable (A,B) SELECT * from table3;

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?