Domandata
FeaturesProductPlansAboutHelp
Sign InCreate Free Account
Domandata
Follow us on LinkedInFollow us on YouTubeFollow us on XFollow us on Bluesky

Product

  • Features
  • Product
  • Plans
  • Changelog

Company

  • About
  • Cite
  • Help
  • Feedback

Compare

  • Switch to Domandata

Account

  • Sign In
  • Create Account

Legal & Trust

  • Privacy
  • Terms
  • Security
  • Trust Center
  • Status
© 2026 Domandata LLC. All rights reserved.
Back to Help
Export

Survey Variable Names and Recodes

Create readable variable names, stable answer labels, and recodes before the data reach analysis.

Why Variable Names And Recodes Matter

Analysis-ready survey data depends on readable variable names and stable coding. Before launching an academic research survey, decide how each key question should appear in exports and how answer options should be represented in analysis.

Variable naming is easiest while you are still in Block Builder. Name the question before using it in Flow, quotas, random assignment, codebooks, API pulls, or analysis scripts.

Changing a variable name or recode value after live data collection has started will break any analysis script, codebook, or API query that references the old name. Freeze names before publishing.

Block Builder: Variable Name

Name A Question In Block Builder

  1. Step 1: Open the question card. In Block Builder, select the question that will appear in analysis, Flow, quotas, or a codebook.

    Step 1: Open the question card

  2. Step 2: Fill in Question Name. Use a short stable name, such as party_id, age, treatment_check, or trust_media.

    Step 2: Fill in Question Name

  3. Step 3: Add recodes where available. For closed options, enter stable numeric or text recodes before publishing.

    Step 3: Add recodes where available

  4. Step 4: Preview and submit a test response. Use Preview to make sure the respondent-facing label still reads naturally.

    Step 4: Preview and submit a test response

  5. Step 5: Open Export. Confirm the exported header and values match the codebook before live data collection.

    Step 5: Open Export

Name Questions For Analysis

Use short, descriptive question names for variables that will appear in models, branching, quota logic, or codebooks. Names such as party_id, age, treatment_check, or trust_media are easier to analyze than long prompt text.

  • Prefer lowercase with underscores: policy_support is easier to use in scripts than a sentence-length prompt.
  • Include the construct, not the wording: trust_court can survive a wording edit better than agree_courts_are_fair.
  • Keep waves or arms explicit: use names such as w2_income or post_trust_media when timing matters.
  • Avoid vague labels: names like question_1, score, and response become hard to audit in exports.

Export: Variable Names in Output

Use Recodes For Stable Values

Recodes let researchers keep exported values stable even if display labels are longer or more participant-friendly. They are especially useful for Multiple Choice, Grid Matrix, Conjoint, and Ranking questions.

  • Ordered scales: use numeric recodes in the same direction across the battery.
  • Nominal categories: use stable text or numeric codes that will not change when labels are edited for readability.
  • Missing-like answers: document Prefer not to answer, Don't know, Other, and skipped values separately.
  • Experimental arms: choose condition codes that analysts can understand without seeing the full treatment text.

Block Builder: Multiple Choice (Recodes)

Selective Adding Variables

When you need totals across several questions rather than a coded interaction of their answer combinations, use a Selective Adding variable in Flow → Variables. It does not build the cartesian answer table that an Extra Recode multi-source interaction does.

  • Count Value Occurrences: pick source questions and/or other Flow variables (including multi-select questions). Each distinct answer value gets its own export column and pipe path as name.value. For example, if questions answer tree, orange, and tree+orange, a variable named var yields var.tree = 2 and var.orange = 2.
  • Highest Value Count: uses the same counting rules, but stores one label — whichever value appeared most often across the sources. A comma-delimited value from a combined source, such as apple, pear, contributes one count to apple and one to pear; it is not treated as a third value. When counts tie, set Tie-Break Order in Flow (comma-separated answer labels; first listed wins). Leave it blank to fall back to source option order. When the sources have a known option list, branching on this variable uses those labels as one variable's discrete options, not an interaction between the variable and each value. Direct values with custom recodes can be used as sources, and their mapped labels are preserved in live links. Runtime recodes are resolved before a dependent combined value is used for branching, in both Preview and live links. Pipe and export it like any other single variable (for example {{var:top_fruit}}).
  • Sum Numeric Values: add numeric answers (or numeric variable values) across the sources into one total — sliders, number fields, Constant Sum totals, choice questions with numeric recodes, and numeric Flow variables.

Add a combined value from the Values section and choose Combined answers. You can include as many sources as you need — combined values do not use the four-source cap that recode interactions do. Sources used inside another combined value must resolve to one scalar value; count-column outputs and Python/R script values cannot be used as scalar sources. Pipe per-value count columns with {{var:name.value}} (for example {{var:fruit.tree}}).

The Flow panel now calls these named outputs Values. Select Add Value and choose whether to create a value from a question, recoded answers, combined answers, or a random draw. Use Import from code for Python or R assignments. Python and R recodes support a returned value, a final expression, or a result assignment; a script that rewrites its source answer is also captured. Dependent values can address each recode by its stable value ID or its name. New values open immediately, and each card shows whether its name and source are ready, whether it is used in branching, and which kind of value it creates. The summary at the top points to values that need attention, and Duplicate value copies a configured value with a fresh name so you can reuse a setup safely.

In the Preview tab, the Live variables panel stays pinned beside the respondent view on larger screens, scrolling on its own when the list is longer than the window, and follows the survey on smaller screens. It updates as answers, question scripts, combined values, and Python/R recodes resolve, so you can inspect the current value without scrolling back to the top. Each variable has a small status dot: green means resolved, solid blue means it is waiting, pale blue means it has not produced a value yet, and red means a recode error occurred. Hover over a dot for its explanation. If a Python or R recode cannot run, a notice at the top of the panel says whether the code runner was unavailable or the script raised an error, and the affected values read Couldn't run.

Recodes built from the recode table — one question's options mapped to values, or an interaction grid across two to four questions — are calculated directly in the survey as respondents answer, so they update instantly and do not depend on the code runner. Once you edit a recode's Python under advanced controls or write it in R, it runs as a script instead.

To route respondents from a value, open its card and select Create branch. The linked branch can be opened from the card, synchronized when the value's known options change, or unlinked while keeping its canvas paths. If the source options change later, the card shows Needs sync and the top summary points to it. Deleting a value first shows the branches, combined values, quotas, or permutation sets that depend on it.

Best Practices

  • Use consistent naming conventions across related surveys, study waves, and library blocks.
  • Keep recodes stable after publishing, and document any mid-field change in the codebook.
  • Document missing values such as Prefer not to answer, skipped, invalid, screen-out, and quota-full paths.
  • Use numeric recodes for ordered scales when that helps analysis.
  • Review exports before collecting live data and again after any major edit.
  • Instrument Review on the Deploy tab flags non-consecutive numeric recodes — gaps in the sequence (for example 1, 2, 4) and repeated codes that would make two options export identically — before you publish.

Related Help

  • Export Research Survey Responses
  • Randomize Survey Questions and Answer Options
  • Design an Academic Survey Instrument
  • Create Your First Academic Research Survey

More Analysis Workflow

Export survey data to Stata, R, or Python with the codebook still attached, then copy a methods-section citation for the software.

  • Export Survey Data to Stata, R, and Python — Export responses, condition assignments, randomized display order, metadata, and documentation for analysis in Stata, R, or Python.
  • Survey Codebook in R and Pre-Analysis Files — Build a survey codebook from variable names, recodes, and a pilot export before analysis in R or Stata.
  • How to Cite Domandata in Your Methods — Copy a ready-made methods sentence plus APA, Chicago, and BibTeX citations, including the software version and Zenodo DOI.
  • Export Instruments, Codebooks, and Flow Diagrams — Download survey instruments, codebooks, Flow diagrams, security overviews, and replication files for review workflows.
  • Randomize Survey Questions and Answer Options — Randomize questions, answers, rows, columns, or sliders when order effects could shape responses, and keep randomization order in export.
  • Pull Survey Responses With the API — Create API keys, pull a full labeled or recoded dataset (CSV, JSON, SPSS, or Stata) plus the codebook, paginate live updates, and recode data in R or Python.

Frequently Asked Questions

Why do variable names and recodes matter in survey research?

Analysis files are unusable when fields are unlabeled or treatments cannot be reconstructed. Set names and recodes in the builder so the export matches the codebook.

When should recodes be defined?

Define them before launch, then verify with a pilot export that recoded values match the analysis plan.