Code Lists

Code Lists

Key Considerations

  • A code list is reusable if the categories and values match exactly. So ‘1-Yes, 2-No’ is different to ‘1-Yes, 0-No’. Likewise, 1-Yes, 2-No is different to 1-yes, 2-no.

  • Code values within a code list must be unique. 

  • Code lists that are used to input X and Y axis labels in grids are not response domains.

Code lists are used for two purposes when documenting a questionnaire:

  • To create a response domain answer when a question asks the respondent to choose from a predefined list of options.

  • To create row and column labels for a question grids.

For both question answers and grid axis labels, code lists generally consist of multiple categories, each of which is assigned a unique code value. Occasionally, a code list may consist of a single code value and category (see Example 2 on the Cardinality page). A code list category is generally text e.g. “Strongly agree”, “Yes”, but can sometimes just be a number. A code list can also contain a mix of numbers and text categories.

Code lists used as an answer to a question are response domains. The Response Domain box on the input page must be ticked when creating the code list for the code list to be available as an answer when creating a question item or question grid. Code lists used to create row and column labels for grids are not response domains. Do not tick the response domain box when creating these types of code lists.

Code lists are reusable when the values and categories are identical (including capitalisation and punctuation), so when a questionnaire contains multiple questions with the same code list, or grids with the same row and column labels, only one code list is created and is reused. The code lists ‘1 Yes, 2 No’, ‘1 Yes, 0 No’, and ‘1 yes, 2 no’ are all different so require separate code list response domains.

Code list label construction

Code list labels start with the prefix cs_. The question reference portion of the label is not collapsed. For example, a code list labelled after question qc_A1_i would have the label cs_qA1_i.

Code lists that are used for a single question reference the question number in the label. A ‘q’ is added before the start of the question reference portion of the label. So the code list label for question qc_A3_a would be cs_qA3_a. 

Code lists that are used for multiple questions reference the categories that make up the code list. The label is made up of the first initial of the word(s) in each category, with an underscore separating the categories. So for a multiple-use code list consisting of the categories ‘All of the time, Some of the time, Hardly ever, Never’, the code list label would be cs_Aott_Sott_He_N. Exceptionally to this, code list categories of ‘yes’ and ‘no’ are always spelt out when they are contained in a multiple-use code list. So for a code list containing ‘Yes, No, Don’t know’ the label would be cs_Yes_No_Dk. 

When code list categories contain punctuation, this is not added to the label. In Example 1 below, qc_30 uses a repeated code list. Although categories 1, 2 and 3 contain the symbol “/”, this is not added to the label. So, this code list label would be cs_MF_Gm_BS_Aar_Aawinar_Acr_Acwinar.

Example 1

Questionnaire: USoc COVID-19 Youth Survey Wave 6

Questionnaire layout:

Archivist Build / Code lists view:

Archivist view (nc_covid_yq6):

Code lists for labelling the X (column) and Y (row) axes in grids usually contain a reference to the grid axis the code list creates. For example, for grid question qc_A4, the label for the Y axis code list would be cs_qA4_Y, and the label for the X axis code list would be cs_qA4_X. The code list labelled cs_dash (containing the single category of '-') is used as the X axis code list for all grids with a single column with no heading label (see Question Grids for more details). When a grid has a corner label, the code list label for either the X or Y axis is the corner label text with the cs_ prefix (see Question Grids and Construct a label for more details).

Assigning code values

A code list value may be a letter, number, roman numeral, or symbol (*), and the values may or may not be sequential. Values within a code list must be unique.

If a question does not contain code values, a numeric code value is entered sequentially for the categories, starting with ‘1’.

Code values for categories that are just a number mirror the number. For example, if a code list had the code list categories 1, 2 and 3, the code list values would be 1, 2, and 3 (see Example 2).

Code lists for labels for ‘X’ and ‘Y’ axes in grids also require code values. These are assigned sequentially, and are always numeric (starting with ‘1’), even if there are letter designations in the questionnaire for the row or column labels.

Cardinality

In addition to code list categories and their code values, cardinality (i.e. the minimum and maximum number of options the respondent can choose) must be added when creating a code list. See the cardinality page for more details.

Scales

There are two types of scale response domains that can be found in questionnaires: those which have discrete points which the respondent can select, and those which are a line the respondent marks. The former are entered as a code list, the latter are yet to be entered into Archivist. Example 1 below shows a question where a code list is used as the response domain to represent the scale.

Example 2

Questionnaire: NCDS What do you think 1991

Questionnaire layout:

Archivist Build / Code lists view:

Archivist view (ncds_91_wdyt):

Concatenating code list categories

Sometimes it is necessary to concatenate code list category text into one category. This could be because extra information is provided at the side of the code list, such as in Example 3, or it could be because there are headings to the categories, such as in Example 4. Example 3 has additional text to the side of the code list which applies to certain categories. If this was added as a statement, it would not be clear which categories this text applies to, so the text is added the code list categories. The order of this concatenation is dependent on the position of the text next to the categories. In this case, the text is positioned before the categories, so it is added before. A colon is added in between to denote the two levels. Example 4 below has code list categories which are divided up by headings which apply to some of the categories. Again, these must be concatenated to the code list category with a colon to denote the levels.

Example 3

Questionnaire: NCDS Interview 1981

Questionnaire layout:

Archivist view (ncds_8_i):

Example 4

Questionnaire: USoc Youth Self-Completion 2009

Questionnaire layout:

Archivist view (us1_ysc):

Multiple code lists

Some questions require more than one code list. This is identified by the change in code values. For more information, see the multiple code lists response domains page.