Responses with numeric codes: fld
Quick reference
To define elements whose condition is that a field contains a specific numeric code, type:
fld column_specs;element_txt1[=code[,code ...] ]; ...
The base, hd=, tx= and =rej options described for col statements are also valid on fld statements.
Most of the data you tabulate consists of codes in columns. Each code in each column represents a different response. For example, if the questionnaire shows:
Q6A: Which types of restaurant did you visit the last three times that you ate out? |
| (12) | (13) | (14) |
Mexican .................... | 1 | 1 | 1 |
Indian ..................... | 2 | 2 | 2 |
French ..................... | 3 | 3 | 3 |
Italian .................... | 4 | 4 | 4 |
Chinese ......-............. | 5 | 5 | 5 |
and the respondent visited Chinese, Thai, and Indian restaurants, you could count the number of respondents who visited a Chinese restaurant by writing an n01 statement:
n01Mexican;c=c12'1' .or. c13'1' .or. c14'1'
Alternatively, you could use integer variables in the edit and set each one to 1 if the respondent visited the type of restaurant. The n01 statement might then be:
n01Mexican;c=t1 .gt. 0
Now suppose that the restaurants are coded with two-digit numeric codes instead. The questionnaire shows:
Q6A: Which types of restaurant did you visit the last three times that you ate out? |
| (12-13) | (14-15) | (16-17) |
Mexican .................... | 01 | 01 | 01 |
Indian ..................... | 02 | 02 | 02 |
French ..................... | 03 | 03 | 03 |
Italian .................... | 04 | 04 | 04 |
Mexican ......-............. | 05 | 05 | 05 |
The n01 for Mexican would be:
n01Mexican;c=c(12,13)=$01$ .or. c(c14,15)=$01$ .or. c(16,17)=$01$
There is nothing wrong with writing statements of this type if this is what you want. However, Quantum offers the choice of using either a fld statement in the axis, or a combination of a field statement in the edit and a bit statement in the axis as a means of avoiding long conditions of this type.
Note The fld statement counts the number of respondents who gave each response and not the number of responses that were given.
fld is like a col or val statement because a single statement can create a number of elements. The format of a fld statement is as follows:
fld col_specs;[base[=btext]];[hd=hdtext];[tx=text];element_specs
The options base, base=, hd= and tx= define base elements, subheadings and text-only elements as they do with col and val statements.
Defining the columns to be read
The column specs on a fld statement define the columns to be read. There are three ways of entering them:
▪List each column or field reference one after the other, separated by commas. The list must be enclosed in parentheses. In the example this would be:
fld (c(12,13), c(14,15), c(16,17))
▪If you have sequential fields as you do here, you can type the start columns of each field followed by the field length. The list of start columns is separated by commas and enclosed in parentheses, and the field length comes after the closing parenthesis and starts with a colon. If you use this notation for the restaurant example you would write:
fld (c12, c14, c16) :2
You can abbreviate this further by typing just the start columns of the first and last fields, followed by the field length. This time you do not use parentheses:
fld c12, c16 :2
▪If the fields are not sequential, you can list the start columns and field width of each group of columns (as shown above) and separate each group with a slash. For example, to read data from columns 12 to 17 and 52 to 57, with each field being two columns wide, you would type:
fld c12, c16 / c52, c56 :2
This reads c(12,13), c(14,15), c(16,17), c(52,53), c(54,55) and c(56,57).
You can also use this notation for single non-sequential fields. For example:
fld c23 / c36 / c71 :2
means c(23,24), c(36,37) and c(71,72).
Defining the element texts
The element specs part of the statement defines the element texts and the codes which represent those responses. If you enter element texts by themselves, Quantum assumes that the first text is code 1, the second text is code 2, and so on. The codes apply to all fields named in the column specs part of the statement. Therefore, to define elements which count the number of people who visited each type of restaurants, write:
fld (c12, c14, c16) :2;Mexican;Indian;French;
+Italian;Chinese
There are several ways of defining the columns: this example is not the only way you can write this statement.
If the response codes are not sequential, or you do not want to list them in sequential order, you must follow the element text with an equals sign and the code number. You can allocate a number of codes to one element by listing them separated by commas; if the codes are a range, type the first and last codes separated by a hyphen. For example:
fld (c12, c14, c16) :2;Asian=2,5;American=1;
++European=3-4
When you type codes in this way, Quantum checks that none of the codes is longer than the given field lengths, and flags any which exceed the field length with an error message. In the example, fields are two columns long so Quantum rejects codes greater than 99 and strings longer than two characters.
When the field you are testing has more than one column, the numeric data must be right-justified for Quantum to recognize it correctly. So in the two-column field in the example, Quantum recognizes the following codes as 1:
01
1
But Quantum does not recognize the following codes as 1 and these codes are ignored:
1
10
If you have responses such as No Answer or Don’t Know with non-numeric codes, type the code enclosed in dollar signs, as shown below:
fld (c12, c14, c16) :2;Mexican;Indian;French;
+Italian;Chinese;None of these=$&&$
You can specify an element to gather responses not counted since the last base by typing an element with the value =rej as you would on a col or val statement.
See also