Tables and axes > More about axes > col statement
 
col statement
Quick reference
To define a list of elements with codes all in the same column, type:
col number;[base;] elm_txt1[='codes1'] [;elm_txt2[='codes2'] ... ]
More information
If several consecutive statements in an axis have conditions defined by a code or codes in the same column, you can replace the individual n01 statements with a single col statement.
One of the simplest col statements is:
col n;[base];Rtext1[='p1'];Rtext2[='p2']
n
The column containing the codes for this question.
base
Creates a base element.
Rtext1=’p1’, Rtext2=’p2’ and so on
The texts and conditions for the individual elements.
To explain more clearly how the col statement works, take the axis mstat that we wrote earlier and rewrite it using a col statement. Originally it consisted of five statements:
n10Base
n01Single;c=c109'1'
n01Married;c=c109'2'
n01Divorced;c=c109'3'
n01Widowed;c=c109'4'
These can be replaced with one line, like this:
col 109;Base;Single;Married;Divorced;Widowed
The texts Single, Married, Divorced and Widowed define the element texts and their positions in the statement tell Quantum which code represents which response.
When Quantum encounters a col statement which just contains element texts, it assumes that those responses are single-coded in the order 1234567890–& and blank. Thus, in the example, Single is the first element so it is assumed to be a code ‘1’ in column 109; Widowed is the fourth element so it is assumed to be a code ‘4’ in column 109.
For example, if you want to print the elements in mstat in a different order, say, Widowed, Single, Married, Divorced, you can either:
write each response followed by its code, thus:
col 109;Base;Widowed=4;Single=1;Married=2;Divorced=3
just define the code for Widowed and let Quantum assign the other codes by default. The default for the first response without a specific code is ‘1’:
col 109;Base;Widowed=4;Single;Married;Divorced
However, if automatic coding has been specified, and then a single element is assigned a specific code, the remaining codes continue from where the automatic numbering left off. Therefore, if the above axis was specified as:
col 109;Base;Widowed;Single;Married=6;Divorced
the first element is Widowed, so it is assigned code ‘1’, Single is code ‘2’, Married is specifically given the code ‘6’, and Divorced reverts to the automatic numbering and is given code ‘3’.
The code list for col consists of 12 codes followed by blank. This means that blank is the 13th code in the list. If a col statement lists 13 responses, the code for the 13th response is blank. For example:
col 234;Base;Brand 1;Brand 2;Brand 3;Brand 4;Brand 5;Brand 6;
+Brand 7;Brand 8;Brand 9;Brand 10;Brand 11;Brand 12;Brand 13
The condition that Quantum applies for Brand 13 is c224’ ’.
Codes can be combined to form ‘or’ conditions. If the condition for an element is one code only, you can write the code without the single quotes. This does not apply when the code is a blank: blanks must be enclosed in single quotes. This example shows both ways of entering codes:
col 109;Base;Divorced/Widowed='34';Single=1;Married=2
This statement creates four elements; a base for everyone eligible for inclusion in the table, and elements for single people, married people and respondents who are divorced or widowed.
Codes on col statements do not have to be exclusive. For example, to create a net for a multicoded response, write:
col 110;Base;All Colors (Net)='1/4';Red;Blue;Green;Yellow
You can use a user-defined data array element in place of a column in the C array. You type the variable name and the number of the column containing the data.
For example:
col color(1);Base;First choice (Net)='1/4';Red;Blue;Green; . . .
col color(2);Base;Second choice (Net)='1/4';Red;Blue;Green; . . .
The respondent’s first choice is read from column 1 of the color array, and the second choice is read from column 2 of the same array.
Note If the code order is anything other than 1234567890-& blank, enter codes for all responses in the list. Doing this enables you to see which code represents which response straightaway, instead of having to look to see which codes have been assigned elsewhere.
Semicolons in element text
Take care if the element text contains a semicolon. Semicolons separate the individual responses on a col statement, so if you want a semicolon to be printed as part of a text, precede it with a backslash. When the text is printed, the backslash is replaced by a space. For example:
col 157;Base;One;Two;Three;Four
creates five rows, but:
col 157;Base;One\;Two='12';Three\;Four='34'
generates three rows, the second of which has the text ‘One ;Two’ and the third of which is ‘Three ;Four’.
See
Continuing col statements
Dealing with “Don’t knows”
Conditions on col statements
Bases on col statements
Subheadings with col
Text-only elements with col
See also
More about axes