• No results found

Responses with numeric codes: fld

In document Quantum User's Guide - Vol2 (Page 108-111)

4 More about axes

4.3 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:

and the respondent saw Columbus, Green Card and Aliens 3, you could count the number of respondents who saw Columbus by writing an n01 statement:

n01Columbus;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 saw the film. The n01 statement might then be:

n01Columbus;c=t1 .gt. 0

Q6A: Which films did you see on your last three visits to the cinema?

(12) (13) (14)

Columbus ... 1 1 1

Aliens 3 ... 2 2 2

Pretty Woman ... 3 3 3

Green Card ... 4 4 4

Batman 2 ... 5 5 5

Quantum User’s Guide Volume 2

More about axes – Chapter 4 / 95 Now suppose that the films are coded with two-digit numeric codes instead. The questionnaire shows:

The n01 for Columbus would be:

n01Columbus;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.

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.

The column specs on a fld statement define the columns to be read. There are three ways of entering them. First, you may list each column or field reference one after the other, separated by commas.

The list must be enclosed in parentheses. In our example this would be:

fld (c(12,13), c(14,15), c(16,17))

Second, 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 film example you would write:

fld (c12, c14, c16) :2

Q6A: Which films did you see on your last three visits to the cinema?

(12-13) (14-15) (16-17) Columbus ... 01 01 01 Aliens 3 ... 02 02 02 Pretty Woman ... 03 03 03 Green Card ... 04 04 04 Batman 2 ... 05 05 05

Quantum User’s Guide Volume 2

96 / More about axes – Chapter 4

If you wish, 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

Third, if the fields are not sequential, you may 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).

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 will count the number of people who saw each film, you would write:

fld (c12, c14, c16) :2;Columbus;Aliens 3;Pretty Woman;

+Green Card;Batman 2

Remember that 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 wish 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;Science Fiction/Fantasy=2,5;Historical=1;

++Others=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 our example, fields are two columns long so Quantum will reject codes greater than 99 and strings longer than two characters.

Quantum User’s Guide Volume 2

More about axes – Chapter 4 / 97 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 our 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;Columbus;Aliens 3;Pretty Woman;

+Green Card;Batman 2;None of these=$&&$

You may 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.

In document Quantum User's Guide - Vol2 (Page 108-111)