> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sprig.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cross Tab Analysis Across Themes

*Sort open-ended responses into themes, then break those themes down by segment. This example has been tested and validated with Claude.*

<Card title="When to use this" type="info">
  * Your question has no pre-built answer to compare- open text like "what's stopping you from doing X" or "what do you wish we'd build next" has to be read and sorted into categories before it can be cross-tabbed.
  * If you already have a rating, tier, or other existing attribute, use the attribute-based cross-tab prompt instead,  it's faster and involves fewer judgment calls.
</Card>

<Tip>
  For the full walkthrough,  including a worked example on a 300-response synthetic dataset and a side-by-side comparison with the attribute-based version, see the [full themed cross-tab guide.](https://sprig.com/guides/cross-tab-analysis-with-claude-advanced)
</Tip>

## Prompt

<Note>
  Replace `[OPEN-ENDED QUESTION COLUMN]`, `[LIST YOUR SEGMENT VARIABLES]`, and `[N]` with your own column names and threshold.
</Note>

```text expandable lines theme={null}
I have a survey dataset with open-ended text responses and demographic
or segment/attribute variables. I want to run a themed cross-tab
analysis on [OPEN-ENDED QUESTION COLUMN].

What this prompt does:
- Reads open-ended responses and sorts them into a manageable set of
  recurring themes
- Cross-tabs those themes against the segments you specify, and checks
  whether any segment has enough responses to draw a real conclusion
  from

What it returns:
- A list of themes with example quotes, so you can check the coding
  before trusting it
- A table of theme counts and percentages, broken out by segment
- A list of any segment comparisons that don't have enough data to trust
- A plain-language summary of the differences worth paying attention to
- A saved image of the table you can download and reuse

Please:
1. Read all non-blank responses in [OPEN-ENDED QUESTION COLUMN] and
   identify the 5-8 recurring themes that best capture the range of
   answers. This is a column header from your data file, exactly as it
   appears in the header row, like `biggest_barrier` or
   `open_feedback`, not a spreadsheet cell reference or column letter.
   Use an "Other/unclear" bucket rather than forcing every response
   into a theme.
2. For each theme, give me 2-3 example quotes or paraphrases so I can
   sanity-check the coding, plus the exact count and percentage of
   responses in that theme, excluding blanks.
3. Assign each response to its single best-fitting theme as a new
   column. Use code, not estimation, to do the counting.
4. Cross-tab the theme variable against these segment variables:
   [LIST YOUR SEGMENT VARIABLES, e.g., plan tier, company size, usage
   frequency]. These are also column headers from your data file, not
   spreadsheet cell references. Show counts and row percentages for
   each.
5. Flag any cross-tab cell with fewer than [N, e.g., 10] respondents. A
   cell with ZERO respondents also counts as under the threshold, not
   just small nonzero counts. Report the total flagged as a single
   number computed directly from the full table, not calculated in
   parts and combined.
6. Before giving me the final answer, recompute every number you're
   about to report directly from the underlying table one more time,
   using a genuinely different method than you used the first time, for
   example a manual count instead of a formula-based one. Simply
   re-running the same calculation again doesn't count as a check.
   Correct anything that doesn't match rather than keeping your
   first-draft number.
7. Summarize 2-3 patterns, and be explicit about which differences look
   meaningful versus likely noise given sample size. Don't overstate
   findings from a small dataset.
8. Save the table itself as an image file I can download, formatted so
   it's easy to read at a glance.
```

## Setup

**Code execution must be enabled** for step 4's verification to run. It's on by default for Team and Enterprise accounts. Free, Pro, and Max users: enable it under **Settings > Capabilities**.

<Tip>
  If your survey data lives in Sprig, skip the export, the [<u>Sprig MCP</u>](/docs/native-ai/sprig-mcp) connects live surveys and responses directly into Claude so the analysis runs on current data.
</Tip>

## How it works

<Steps>
  <Step title="Theme identification">
    Reads all non-blank responses and identifies 5–8 recurring themes. Responses that don't clearly fit go into an "Other/unclear" bucket rather than being forced into a theme.
  </Step>

  <Step title="Theme preview with quotes">
    Returns 2–3 example quotes per theme so you can verify the coding before trusting the counts. If a theme groups things you'd keep separate, check the quotes, tell Claude the split you want, and ask it to recode.
  </Step>

  <Step title="Theme assignment">
    Assigns each response to exactly one best-fitting theme as a new column. Uses code to count, not estimation.
  </Step>

  <Step title="Cross-tabulate">
    Cross-tabs the theme variable against your segment variables. Returns counts and row percentages for each cell.
  </Step>

  <Step title="Flag thin cells">
    Any cell below your threshold (e.g., 10 respondents) is flagged, including cells with zero respondents. The total flagged is computed from the full table at once,  not assembled from separate counts. *More themes × more segments = more flagged cells. That's your sample size talking, not a failure of the method.*
  </Step>

  <Step title="Independent verification">
    Every number is recomputed using a genuinely different method before it's reported. This step caught a specific error in testing: cells with exactly zero respondents were counted separately and then dropped from the flagged total. The prompt now requires a single count computed directly from the full table, and an independent recompute to catch this before it reaches you.
  </Step>

  <Step title="Plain-language summary">
    2–3 patterns, with explicit notes on which differences are meaningful versus likely noise given the sample size.
  </Step>

  <Step title="Exportable table">
    The final table is saved as a downloadable image, formatted for quick reading.
  </Step>
</Steps>

## Customize for your dataset

| **Setting**                  | **Default**    | **When to adjust**                                                   |
| :--------------------------- | :------------- | :------------------------------------------------------------------- |
| Number of themes (step 1)    | 5–8            | Fewer for small datasets; up to 10–12 for long, varied response sets |
| Thin-cell threshold (step 5) | 10 respondents | Drop to 5 for a pilot study; raise to 20–30 for large-scale surveys  |

## Verify your own results

* **Do theme counts sum correctly?** Total coded responses should equal your non-blank count.
* **Spot-check at least one cell.** Manually filter one segment and compare its theme breakdown to what was reported.
* **Treat flagged cells as unreliable.** Even if a number looks clean, don't act on it if the cell was flagged.

<Warning>
  The verification steps in the prompt (steps 5–6) catch a lot, but they're a safety net, not a guarantee. Spot-check before you publish or present.
</Warning>
