Plan Analysis Before Data Collection
A pre-analysis plan and survey codebook connect the instrument to analysis in R or Stata. Name variables before launch, export a pilot, and keep assigned conditions and randomization order in the same files you will open in haven or Stata.
Block Builder: Variable Name
Use Domandata While Writing The Codebook
Step 1: Draft the instrument map. Before building, list constructs, outcomes, condition arms, and planned exclusions; use Design an Academic Survey Instrument for the planning pass.
Step 1: Draft the instrument map
Step 2: Name variables in Block Builder. Add short question names and recodes for analysis-critical fields before pilot testing.
Step 2: Name variables in Block Builder
Step 3: Confirm assignment in Flow. Open Flow condition sets and record each condition set, arm label, assignment mode, and route.
Step 3: Confirm assignment in Flow
Step 4: Submit pilot responses. Use Preview to create test data for every major path.
Step 4: Submit pilot responses
Step 5: Open Export. Download the pilot export and use its headers to finish the codebook.
Step 5: Open Export
Step 6: Update after changes. When a live survey changes, document what changed, when it changed, and how analysis should treat the affected responses before you publish again.
Step 6: Update after changes
What To Document
- Research questions and hypotheses.
- Primary and secondary outcomes.
- Experimental condition arms and assignment percentages.
- Variable names, answer labels, and recodes.
- Attention checks, manipulation checks, and exclusion rules.
- Quota targets and sample allocation assumptions.
- Any randomization or display-order fields needed for analysis.
Flow: Conditions and Routing
Use Domandata Exports
Submit pilot responses and export the data before launch. Use the export headers to confirm planned variable names, recodes, condition assignments, and randomized order fields. Adjust the codebook before collecting live responses.
Export: Data Output
Keep Changes Traceable
If you revise a live survey, document what changed and when. Avoid changing labels, recodes, condition arms, or quota logic unless the change is necessary and accounted for in analysis.
Flow: Conditions and Routing
Survey Codebook In R
After a pilot, download Codebook.csv from Export or the replication package. In R, read it alongside the response file (CSV or haven::read_dta("Responses.dta")) so labels, recodes, and condition arms match the analysis plan. If you pull data with the API, dd_codebook() returns the same dictionary. See Export Survey Data to Stata, R, and Python.
Export: Codebook with the response file