Tutorials › Regression Analysis (Undergraduate) › Handling Multiple Responses in One Field

Data Structure and Variable Preparation · Tutorial 47 of 991

Handling Multiple Responses in One Field

Recognize multi-response fields and restructure them carefully while retaining the connection to each original observation.

Beginner 10 min read

What You'll Learn

  • Distinguish multiple selections in one field from one compound category or a delimiter inside a label
  • Choose between long-format responses and one indicator column per option
  • Preserve an identifier that links every separated response to its original unit
  • Handle blank fields, duplicate entries, and unexpected labels explicitly
  • Check row counts and response totals after restructuring

Why One Field Can Hold More Than One Response

A data table often appears to have one value in each cell. But a cell may contain a list, such as “urban; rural,” when a person selected two answers or an observational unit is associated with two categories. Treating that whole string as one ordinary category can hide the structure of the data. Splitting it carelessly can cause a different problem: the separated responses may no longer be traceable to the person, place, or other unit they came from.

The first task is therefore not to split every cell that contains punctuation. It is to determine what the field represents. A semicolon might separate several selected answers, but it might also be part of a single label, an entry in free text, or a formatting convention. The intended meaning should be checked against the question wording, data dictionary, or collection process before restructuring.

Definition: A multiple-response field is a field in which one recorded cell represents two or more distinct responses for the same original observational unit. Restructuring separates those responses into individually identifiable values while retaining a key that links them to that unit. A delimiter, such as a semicolon, is only evidence of a possible list; its meaning must be verified.

For example, suppose each survey row represents one respondent, and a question asks which settings the respondent uses. A cell reading “urban; rural” may record two selections. The original observational unit remains the respondent; separating the selections does not turn that respondent into two independent respondents. This distinction matters whenever the prepared data are summarized or used in an analysis.

Decide What the Field Means Before Changing Its Shape

Before splitting a field, answer three questions. First, what is the original observational unit represented by one row? Second, can a unit validly have more than one response to this particular question? Third, what exactly separates responses in the stored text? If those answers are uncertain, retain the original field and investigate rather than guessing.

Also distinguish a list of responses from a single category. “Urban; rural” might mean two selected settings if the form allowed multiple selections. In a different data source, it could be a single textual label or an incorrectly entered value. Similarly, commas may separate answers in one field but appear inside a legitimate answer such as “Portland, Maine.” Splitting on punctuation alone is not a reliable rule.

Once the field is confirmed to contain multiple responses, two common structures are useful:

StructureWhat one row representsUseful when
Long response tableOne original unit and one of its responsesThe number of responses differs among units, or each response needs its own row
Wide indicator tableOne original unit, with one column for each possible responseThe response options are known and each unit needs one row with selection indicators

In either structure, keep the original unit’s identifier. In a long table, the identifier will usually repeat across that unit’s response rows. In a wide indicator table, it usually appears once. Do not use the new row number as a substitute for the original identifier: a newly created row identifies a response record, not necessarily a new person or other original unit.

Worked Example: Separating Two Settings Without Losing Respondent Identity

Suppose a hypothetical survey asks each respondent to select all settings in which they shop. The question allows multiple selections, and the verified stored delimiter is a semicolon. The source data are:

Respondent IDSettings selected
R21urban; rural
R22rural
R23urban; coastal

The original unit is the respondent, and the field contains a list of selected settings. In a long response table, split each list at the verified semicolon and keep the ID on each resulting response row:

Respondent IDSelected setting
R21urban
R21rural
R22rural
R23urban
R23coastal

There are \(2+1+2=5\) response rows: two for R21, one for R22, and two for R23. There are still only three respondents. The repeated ID is what allows each response to remain connected to its source respondent.

A wide alternative has one column for each response option and uses 1 for selected and 0 for not selected:

Respondent IDUrbanRuralCoastal
R21110
R22010
R23101

The coding is justified here because the selection options are known and the question permits more than one selection. The indicators do not add up to one for each respondent: R21 and R23 each selected two settings. That is expected for this question, not an error.

What Restructuring Preserves

A useful check is to describe the response list for each original unit as a set of selected values. If respondent \(i\) selected the set \(S_i\), the long table should contain exactly one row for each value in \(S_i\), paired with respondent \(i\)’s identifier. Its response rows should therefore reproduce the original membership of every set.

$$ \text{number of long rows}=\sum_{i=1}^{n}|S_i| $$

Here \(n\) is the number of original units with a recorded list, and \(|S_i|\) is the number of distinct responses represented for unit \(i\), under the chosen duplicate-handling rule. This identity gives a basic row-count check. It does not by itself prove that the values were parsed correctly, so the resulting labels and IDs must also be inspected.

For an indicator table with \(K\) valid options, each original unit has \(K\) indicators. For a given unit and option, the indicator is 1 if that option appears in the recorded response and 0 if it does not. This representation preserves which options were selected, provided the option list is complete and the meaning of unselected is known.

Worked Example: Checking a Long-Format Transformation

Consider a second hypothetical survey with three households. Each row records the services that household selected from a fixed list. The recorded lists are:

Household IDRecorded services
H5clinic; pharmacy
H6pharmacy; school; library
H7clinic

Assume the semicolon is a verified separator, and each service appears at most once per household. The list sizes are \(|S_5|=2\), \(|S_6|=3\), and \(|S_7|=1\). Thus the expected number of long-format rows is:

$$ 2+3+1=6 $$

The resulting table contains the pairs (H5, clinic), (H5, pharmacy), (H6, pharmacy), (H6, school), (H6, library), and (H7, clinic), for six rows. The count agrees with the expected total. Each household ID appears as many times as that household has listed services, so the original household remains identifiable.

A corresponding wide table would have four columns for the four distinct services, plus the household ID. H5 would have indicators 1, 1, 0, 0 for clinic, pharmacy, school, and library; H6 would have 0, 1, 1, 1; and H7 would have 1, 0, 0, 0. Each row still represents one household. The wide and long forms contain the same selection information, but organize it differently.

Handle Blanks, Duplicates, and Unexpected Entries Explicitly

A blank cell needs particular care. It might mean no options were selected, the respondent skipped the question, the value was not recorded, or the response was lost during data entry. These meanings are not interchangeable. Do not silently convert a blank to “none” unless the collection rules establish that a blank means no selection. If the meaning is unknown, preserve it as unknown and document that decision.

A repeated answer in one cell also deserves inspection. For example, “bus; walk; bus” may be an accidental duplicate if the question records which modes were selected, where each mode should appear at most once. In that case, a defensible rule is to retain one “bus” and one “walk” response, while recording that duplicates were found and removed. But if repeated values represent separate events or counts, deduplication would discard information. The field’s meaning determines the rule.

After splitting, check for empty tokens, extra spaces, inconsistent capitalization, and values not in the expected option list. Trimming spaces or applying a documented label map may be appropriate, but unexpected values should not be silently changed into a familiar option. Keep the untouched source value so that each preparation decision can be traced back to what was recorded.

Worked Example: Cleaning a Delimited Field With a Duplicate

In a hypothetical travel survey, each participant lists the travel modes used on a particular commute. The response options are bus, walk, and bicycle, and the question records selected modes rather than the number of times each mode was used. The raw entries are:

Participant IDRaw response
P8Bus; walk; Bus
P9bicycle ; bus

The stated question allows a mode to be selected only once. Therefore, the two “Bus” tokens for P8 represent a duplicate entry, not two bus trips. After splitting on the verified semicolon, trimming surrounding spaces, and applying a documented case standard, P8 has the distinct selections bus and walk. P9 has bicycle and bus.

The long table is:

Participant IDSelected mode
P8bus
P8walk
P9bicycle
P9bus

Before removing the duplicate, there are \(3+2=5\) tokens in the raw lists. After applying the justified deduplication rule, there are \(2+2=4\) distinct participant-mode pairs. The count changes because one repeated selection was removed; both the raw response and the rule should be retained so this change is explainable. If the question had asked for a count of trips rather than selected modes, removing the repeated “Bus” could have been wrong.

Why the Original Unit Still Matters

Expanding a list into several rows changes the number of rows, not the number of original observational units. If the original unit is a respondent, a long-format row represents a respondent-response pair. Treating every such row as a new respondent would count people with more selections multiple times and could misrepresent the data. Keep this distinction clear when preparing the table for later summaries or analysis.

It can help to retain two linked tables: an original-unit table with one row per respondent and a response table with one row per respondent-selection. The shared identifier links them. This is especially useful when the original table contains other respondent-level variables: those variables should not be copied into a long table and then mistaken for independent information on every response row.

A concise audit can record the source field, the verified delimiter or parsing rule, the identifier used to link responses to original units, how blanks were treated, how duplicates were handled, and the row counts before and after restructuring. Keeping the raw field alongside the prepared values makes it possible to check a questionable entry without trying to reconstruct what was originally recorded.

Common Mistakes

  • Treating the whole list as one category. Calling “urban; rural” a single category loses the fact that two settings were selected when the question allowed multiple answers. Confirm the field’s meaning, then represent each response separately.
  • Splitting on punctuation without checking it. A delimiter can occur inside a valid label or free-text response. Verify the separator and the option labels before parsing.
  • Dropping the original identifier. Separate response rows without a source ID cannot reliably be linked back to their respondent or other original unit. Carry the key into each long-format row.
  • Counting expanded rows as original units. Five response rows may come from only three respondents. State what a row represents after restructuring.
  • Assuming blank means none. A blank may be missing or skipped rather than an explicit empty selection. Use the documented collection meaning, or retain the uncertainty.
  • Removing duplicates automatically. Repetition may be an error in a multiple-choice field, but it can be meaningful in a field that records repeated events. Apply a rule based on the question’s meaning.
Key takeaway: Confirm that a cell truly contains multiple responses, choose a structure that matches the task, and preserve the identifier for the original unit. Verify the transformed labels and row counts, and document how blanks, duplicates, and unexpected values were handled.

Check Your Understanding

For each question, identify the preparation decision or check that is needed.

  1. A survey row contains “urban; rural.” What should you verify before treating this as two responses?
  2. Four respondents have response-list sizes 1, 2, 0, and 3. If the zero means a recorded empty selection, how many response rows should a long-format table contain? What does that total count?
  3. Why should a respondent ID repeat on multiple rows after a multi-response field is split?
  4. A blank response cell is present. Name two possible meanings and explain why they should not be treated as equivalent.
  5. A field contains “bus; bus; walk.” What information about the question would help decide whether the repeated bus entry should be removed?