5  Coding

Where this chapter fits. Step 7 of the research process is to prepare, analyze, and interpret the data. This chapter covers the first part of the analysis, which is coding.

5.1 Twelve Transcripts on a Table

A researcher has finished 12 interviews about housing. Each one has been transcribed and checked. Names and places have been replaced with labels. The transcripts are printed and stacked on a table.

She has read each one at least once. She remembers Avery’s son, who stopped doing homework in a crowded living room. She remembers Casey, who showered at a gym before work and told no one he was living in his car. She has a strong sense that the interviews are “about” something. She cannot yet say what, in a way that another person could check.

Memory is a poor tool for this step. It keeps the vivid stories and drops the plain ones. It also favors whatever the researcher expected to find. A reader of her report would have to trust her impressions.

Coding replaces impression with a procedure. The researcher goes through every transcript and attaches a short label to each passage that bears on the research question. When she finishes, she can pull every passage with a given label and read them together. This chapter covers how to do that.

The 12 interviews in this chapter are synthetic. They were written for this book, and no real person said these words. The full transcripts are in the book’s files as H01 through H12.

5.2 What a Code Is

A code is a short label that names what a passage of text is about. A segment is the passage the label is attached to. A segment can be a phrase, a sentence, or several sentences. It should be long enough to make sense when read alone.

Here is one answer from Avery, the first participant.

Synthetic “I called 211. They gave me a list. Every place on the list either had no money left or you had to have an eviction notice. I didn’t have a notice. I left before it got to that. So I didn’t count.”

A researcher could attach the code Help requires a crisis to this segment. The label is short. It names what the passage is about in a way that could apply to other passages. It stays close to what Avery said and does not yet explain it.

A code is not a summary of one passage. “Avery called 211 and was turned away” describes this passage only. A code has to be general enough to be used again. When the caseworker in interview 8 says “No lease, no help,” the same code applies.

5.3 Read Before You Code

Coding begins with reading. Read every transcript from start to finish before attaching any label. Braun and Clarke (2006) call this step familiarization.

Read with a pen. Mark passages that seem important, and write a few words in the margin about why. Do not try to be consistent yet. The purpose is to learn what is in the material as a whole.

After the first reading, write a memo of a page or less. Note what came up often, what surprised you, and what you expected and did not find. Chapter 2 introduced the memo. From this point on, the researcher writes one whenever her thinking changes.

5.4 Where Codes Come From

Codes come from two directions.

In inductive coding, the researcher builds the codes from the data. She reads a passage, asks what it is about, and writes a label. The codes are not decided in advance. This approach suits a study in which the researcher does not yet know what matters to participants.

In deductive coding, the researcher begins with a list of codes taken from the research question, from earlier research, or from a framework. She then looks for passages that fit each one. This approach suits an evaluation that has set questions to answer.

Most applied studies combine the two. The researcher starts with a few codes that the research question requires and adds others as she reads. In the housing study, a question about help-seeking was in the interview guide, so a code for it was planned. No one planned a code for concealment. It came from the data, after several participants described hiding their situation.

5.5 Kinds of Codes

Saldaña (2021) describes many kinds of codes. Three are enough to begin.

A descriptive code names the topic of a passage in a word or short phrase. Rent increase and Children and school are descriptive codes.

An in vivo code uses the participant’s own words as the label. Sasha, in interview 2, says, “It’s the not knowing.” Not knowing became the label for a code about uncertainty. In vivo codes keep the analysis close to how participants see their own situation.

A process code names an action, usually with a word that ends in “-ing.” Doubling up and Cutting back are process codes. They suit passages that describe what people do.

Table 5.1 shows how the first part of Avery’s interview was coded.

Table 5.1: Six coded segments from interview H01. Synthetic data.
Segment Code Kind
“New owner sent a letter, rent goes from 1,150 to 1,600.” Rent increase Descriptive
“they all want three times the rent in income” Screening barriers Descriptive
“Five people. We did that for five months.” Doubling up and informal housing Process
“My son stopped doing homework. There was no place to do it.” Children and school Descriptive
“Because then you’re that family.” Concealment Descriptive
“You have to be all the way at the bottom before they can help you.” Help requires a crisis Descriptive

A segment can carry more than one code. When Jordan’s 12-year-old daughter finds the notice and texts, “Mom, are we getting kicked out?”, the passage concerns both a child and a dealing with the landlord. It can be coded for both.

5.6 The Codebook

As codes are created, the researcher records them in a codebook. A codebook is a list of every code with the rules for using it. It is what makes coding consistent from the first transcript to the last and from one coder to another.

MacQueen and colleagues (1998) recommend that each entry contain five things.

  1. A name. A short label.
  2. A definition. One or two sentences that state what the code covers.
  3. When to use it. The features that a passage has to have.
  4. When not to use it. Passages that look similar and belong under a different code.
  5. An example. A segment from the data that fits well.

Here is one full entry from the housing codebook.

Table 5.2: One entry from the codebook for the synthetic housing interviews.
Name Help requires a crisis
Definition Help is tied to a notice, a document, or a waitlist.
Use when The participant describes a rule that made help unavailable until the problem got worse, or a wait too long to be of use.
Do not use when The participant was refused housing by a landlord. Use Screening barriers.
Example “You have to be all the way at the bottom before they can help you.” (H01)

The fourth line does the most to keep coders consistent. Two codes often cover neighboring ideas. A rule that states where one ends and the other begins prevents the same kind of passage from being coded two ways.

Table 5.3 lists all 14 codes with their definitions.

Table 5.3: The 14 codes used for the synthetic housing interviews, with definitions.
Code Definition
Rent increase The participant describes a rise in rent or a notice of one.
Cutting back and debt The participant cuts other spending, pays fees, or takes on debt to cover housing.
Landlord’s costs A landlord describes taxes, insurance, repairs, or pressure to sell.
Doubling up and informal housing The participant stays with others, in a car, or in a room with no lease.
Concealment The participant hides the situation or rejects a label such as homeless.
Not knowing The participant describes fear of a notice or an inability to plan.
Help requires a crisis Help is tied to a notice, a document, or a waitlist.
Screening barriers Credit checks, income rules, or refusals keep the participant out of housing.
A person who knows One person with knowledge or authority changes the outcome.
Dealing with the landlord The participant describes contact, or a lack of contact, with a landlord or company.
Children and school Housing problems affect children or schooling.
Work Housing problems affect work, pay, or the commute.
Health and caregiving Illness or caregiving is tied to the housing problem.
Moving by choice The participant describes a move as chosen and positive.

5.7 Work With the Data: Coding Workbench

A codebook is easier to understand after you have used one. The tool shows the 12 synthetic interviews with the 14 codes from Table 5.3. Code one interview before you read further.

Open Coding Workbench in its own window

  1. Choose interview H01. Read all of it once before you code anything.
  2. Select a passage. Choose a code and read its definition under the list. If the definition fits, press “Add code.”
  3. Code the rest of the interview in the same way. A passage can receive more than one code.
  4. Press “Compare.” The tool lists the segments coded for this chapter and marks the codes you did not use.
  5. For each difference, read the definition again. Decide whether you would change your coding or the definition.

A difference between two coders is information about the codebook. It usually points to a definition that is too broad or to a boundary between two codes that is unclear. The next section shows how a codebook is revised for this reason. You can download your coded segments as a CSV file and keep them for Chapter 6.

5.8 The Codebook Changes

A codebook is not finished after the first transcript. It changes as the researcher reads more, in three ways.

New codes are added. A passage does not fit any existing code. In the housing study, interview 6 was with Quinn, who moved by choice and was glad of it. No existing code fit. A new code, Moving by choice, was added.

Codes are split. A code that covers too much is divided. An early code named Money covered rent increases, late fees, credit card debt, and landlords’ tax bills. It was split into Rent increase, Cutting back and debt, and Landlord’s costs.

Codes are merged. Two codes that cannot be told apart in practice are combined. Fear of a notice and Cannot plan were merged into Not knowing.

Researchers sometimes describe themselves as lumpers or splitters. A lumper uses a few broad codes, and a splitter uses many narrow ones. Too few codes hide differences that matter. Too many make the next step unmanageable. For a study of 10 to 20 interviews, 15 to 40 codes is a common range.

Every change to the codebook creates work. If a code is split after six transcripts have been coded, the researcher goes back and recodes those six under the new rules. Record each change in a memo with the date and the reason.

5.9 What the Coding Shows

When all 12 transcripts are coded, the researcher can count. Figure 5.1 shows how many of the 12 interviews contain each code.

Figure 5.1: Number of the 12 synthetic housing interviews in which each code appears. Eight codes appear in at least four interviews. One code, Moving by choice, appears in a single interview. Synthetic data.

These counts need careful reading. They describe the 12 transcripts. They do not estimate how common each experience is among renters. Chapter 1 explained why a qualitative sample does not support that kind of claim.

Counts are still useful inside the study. They show which codes have enough material to examine closely. They also guard against a common error. A researcher who remembers two vivid accounts of concealment may believe that “everyone” described it. The count shows the number of interviews in which it appeared.

A code that appears once is not unimportant. Moving by choice appears in one interview. Chapter 6 shows that this one case changes how the other eleven should be read.

5.10 Tools for Coding

Coding can be done on paper with colored pens, in a spreadsheet, or in software made for the purpose. Common programs include NVivo, ATLAS.ti, MAXQDA, and Dedoose. All of them let a researcher select a passage, attach codes, and pull every passage with a given code.

The software stores and retrieves. It does not decide what a passage means. For a study of a dozen interviews, a spreadsheet works. Use one row for each segment, with columns for the transcript, the segment, and the code. The file housing-coded-segments.csv in this book is laid out that way.

A Test for a Code Definition

Give the definition and three passages to someone who has not seen the study. Ask which passages fit the code. If the person’s answers differ from yours, the definition needs another sentence. Chapter 7 turns this test into a formal check.

Ethics Moment: The Label Is a Judgment

A code is the researcher’s word for what a participant said. A careless label can pass judgment on the person. A passage in which a parent describes leaving before an eviction could be coded Giving up or Leaving early to avoid a record. The first label blames her. The second describes a decision she made for a reason. Read each code name and ask whether the participant would accept it as a fair description. Where one fits, use the participant’s own words as the label.

AI Reality Check: Fast Codes That Need Checking

A language model can read a transcript and return a list of codes with matching quotations in under a minute. The output looks finished, and three problems are common in it. A model may “quote” words that do not appear in the transcript. Search for every quotation before you accept it. A model may also give different codes to the same passage when asked twice. Give it a written codebook and ask it to apply those codes only. Finally, a model tends to code the surface topic and miss what a passage implies. It will label Casey’s account of the gym and the library as Daily routine. A careful reader sees that it is about concealment. Treat a model’s codes as a second coder’s first attempt. Chapter 7 shows how to measure how far that attempt agrees with your own.

5.11 Putting It All Together

Coding attaches a short label to each passage of text that bears on the research question. It replaces a general impression with a record that another person can inspect. Codes can be built from the data, taken from the research question, or both. Descriptive, in vivo, and process codes are three common kinds.

A codebook lists each code with a definition, rules for when to use it and when not to, and an example. The codebook changes as the researcher reads, and each change means recoding earlier transcripts. Counts of codes describe the study’s own material and help the researcher check her impressions. They do not estimate how common an experience is in a population.

5.12 Looking Ahead

The 12 interviews now carry 65 coded segments under 14 codes. A list of codes is not yet a finding. Chapter 6 covers how codes are grouped into themes and how a theme is stated as a claim. It also covers how to test that claim against the cases that do not fit.

5.13 Further Reading and References

  • Saldaña, J. (2021). The Coding Manual for Qualitative Researchers (4th ed.). Sage. The standard reference on kinds of codes.
  • MacQueen, K. M., McLellan, E., Kay, K., and Milstein, B. (1998). Codebook development for team-based qualitative analysis. Cultural Anthropology Methods, 10(2), 31 to 36. The source of the codebook structure used here.
  • Braun, V., and Clarke, V. (2006). Using thematic analysis in psychology. Qualitative Research in Psychology, 3(2), 77 to 101.
  • Miles, M. B., Huberman, A. M., and Saldaña, J. (2020). Qualitative Data Analysis: A Methods Sourcebook (4th ed.). Sage.
  • Charmaz, K. (2014). Constructing Grounded Theory (2nd ed.). Sage. Chapters 5 and 6 cover initial and focused coding.

5.14 Key Terms

  • Code. A short label that names what a passage of text is about.
  • Codebook. A list of every code with the rules for using it.
  • Coding. Attaching codes to passages of text by a consistent procedure.
  • Deductive coding. Coding with a list of codes set in advance.
  • Descriptive code. A code that names the topic of a passage.
  • In vivo code. A code that uses the participant’s own words as the label.
  • Inductive coding. Building codes from the data.
  • Process code. A code that names an action.
  • Segment. The passage of text to which a code is attached.

5.15 Exercises

Check Your Understanding

  1. Explain the difference between a code and a summary of a passage.
  2. Name the five parts of a codebook entry. Which part does the most to keep two coders consistent, and why?
  3. A researcher splits one code into three after coding half the transcripts. What does she have to do next?
  4. Moving by choice appears in one of 12 interviews. Give one reason it could still matter to the analysis.

Apply It

  1. Read transcript H09 in the corpus. Code at least five segments with the codes in Table 5.3. List each segment with its code.
  2. Write a full codebook entry, with all five parts, for the code Concealment.
  3. Use the file housing-coded-segments.csv. Which code has the most segments? In how many different interviews does it appear?

Think Deeper

  1. Two researchers code the same passage. One uses Giving up and the other uses Leaving early to avoid a record. What does each label assume about the participant? How would you decide between them?
  2. A study of 15 interviews ends with 110 codes. Another ends with 6. What problem does each researcher face at the next step?
  3. Ask a language model to code transcript H05 without giving it a codebook. Compare its codes with the ones in this chapter. Check each quotation it gives against the transcript. Report what you found.