9. Cohort Tags [TAG:], 2D Numeric Matrices & Compound Screening
Clean segment thresholds ([TAG: "ACADEMIC"]) and cross-column numeric sums without duplicating survey questions.
Cohort Tags ([TAG:]), 2D Numeric Matrices & Compound Screening#
In clinical and B2B studies, researchers often classify respondents early (for example, Academic vs. Community clinicians) and apply segment-specific qualification thresholds later without duplicating survey items.
1. Segment Tagging with [TAG: "..."]#
Attach semantic cohort tags directly to choice options and reference them in downstream [CLOSE IF] or [SHOW IF] rules:
[SCREENER]
S15. In which type of medical practice setting do you spend most of your time?
[SINGLE CHOICE]
1. Academic or teaching hospital [TAG: "ACADEMIC"]
2. Community non-teaching hospital [TAG: "COMMUNITY"]
3. Independent private practice [TAG: "COMMUNITY"]
4. Government or VA facility [CLOSE]
S16. What percentage of your time is spent in direct patient care?
[OPEN NUMERIC; 0-100; %]
[CLOSE IF TAG:"ACADEMIC" AND answers.S16 < 50]
[CLOSE IF TAG:"COMMUNITY" AND answers.S16 < 70]- Why researchers love this: Academic clinicians qualify at 50% direct care while community clinicians require 70%, keeping a single unified
S16variable in your Excel/SPSS export.
2. Multi-Column Numeric Matrices: Partial Row Sums vs. Total Column Sums#
Capture numerical volumes across two or more comparable columns (such as multiple indications or brands) and trigger screenouts or branching on either horizontal row sums or vertical column totals:
[SURVEY]
# Dimension: Patient Treatment Volume
S19. In the past 12 months, how many FL and DLBCL patients received each therapy?
[MATRIX; OPEN NUMERIC; 0-500; patients]
COLUMNS:
1. FL (A)
2. DLBCL (B)
ROWS:
1. Bispecific antibodies [CLOSE IF A + B < 5]
2. CAR-T cell therapy
3. Standard chemoimmunotherapy
[CLOSE IF COL(A) < 5]
S20. Which statement best describes your involvement with bispecific antibodies?
[SHOW IF (answers.S19.1.1 + answers.S19.1.2) >= 5]
[SINGLE CHOICE]
1. Referred patients elsewhere [CLOSE]
2. Managed step-up and ongoing doses at my site
3. Managed ongoing therapeutic doses onlyHow Partial Row Sums vs. Column Totals Appear in Termination Events#
| Methodological Need | Supported Syntax | Termination Event Representation |
|---|---|---|
| Partial row sum across columns | [CLOSE IF A + B < 5] or [CLOSE IF answers.S19.1.1 + answers.S19.1.2 < 5] (aliases ROW_SUM, TOTAL) | Evaluates the sum inside that specific row. When triggered, ends the session with SCREEN_OUT and records the exact row reason (e.g. Row 1: [CLOSE IF A + B < 5]). |
| Total column sum across all rows | [CLOSE IF COL(A) < 5], [CLOSE IF SUM(COL(A)) < 5], or [CLOSE IF SUM(S19.*.A) < 5] | Aggregates every row entry vertically under column A (S19.*.A). When below threshold, ends with SCREEN_OUT citing the column rule ([CLOSE IF COL(A) < 5]). |
| Full sum across all columns of one row | [CLOSE IF SUM(S19.1) < 5] or [CLOSE IF SUM(S19.1.*) < 5] | Sums all numeric columns in row 1 without listing column aliases individually. |
| Disjunctive qualifier ("pass if any row qualifies") | [OR_CONTINUE IF >= 20] on eligible rows | Unlike multiple [CLOSE IF ...] rules (any single row fails), [OR_CONTINUE IF] triggers SCREEN_OUT only when every flagged row fails. |
3. Cross-Question Validation ([VALIDATE:]), FOR_EACH_ROW & Derived [COMPUTE:] Variables#
Validate numeric totals and 2D matrices directly against previous answers without duplicating manual state variables:
| Use Case | Recommended Syntax | Runtime & Compiler Behavior |
|---|---|---|
| 1D sum equal to prior answer | [VALIDATE: SUM(S3.*) == S2 ERROR "Sum ({{CURRENT}}) must equal your [PIPE: S2] cases"] (or shorthand [MATRIX; OPEN NUMERIC; 0-999; cases; SUM = S2]) | Renders a live balance indicator (28 / 40 cases) and blocks Next on mismatch. Automatically re-evaluates if the respondent navigates Back and edits S2. |
| 2D column total vs. prior answer | [VALIDATE: SUM(COL(A)) == S2 ERROR "Total ({{CURRENT}}) must equal [PIPE: S2]"] | Displays live column totals in the 2D table footer. |
| Per-row 2D column constraint | [VALIDATE: FOR_EACH_ROW B <= A ERROR "{{ROW_LABEL}}: treated ({{CURRENT}}) exceeds diagnosed ({{TARGET}})"] | Highlights the exact offending row with an inline error. |
| Cross-matrix breakdown | [VALIDATE: FOR_EACH_ROW SUM(M2.ROW.*) == M1.ROW.B ERROR "..."] | Enforces that each row of M2 sums to the matching cell in M1. |
| Confirmable soft warning | [VALIDATE: SUM(COL(B)) <= S2 WARN "Please confirm these values"] | Displays an amber check banner with an explicit confirmation checkbox. |
| Reactive derived variable | [COMPUTE: annual_cases = S2 * 12] | Pure formula computed from answers (never stale on Back navigation). |
Bias-free numeric inputs: [OPEN NUMERIC] fields render neutral placeholders (never leaking min-max) and validate non-destructively without silently clamping respondent input. In [SCREENER] items, use a neutral technical floor (0-999) with explicit [CLOSE IF S2 < 1] screening to avoid L025 warnings.
Keep codebook labels clean with # Dimension:: Place # Dimension: Construct Name on its own line immediately above a question to organize constructs internally without showing technical labels to respondents.
Was this article helpful?
Your feedback helps us continuously improve our technical guides.