Skip to content

Recode Variables in Variable View

Got a 0–10 score that you’d rather see as Detractors, Passives and Promoters? Or ages you’d like in bands? Recode builds a new variable from an existing one, right in Variable View. You write a few rules, watch a live preview of how your records land, and click DONE.

There’s no wrangle to build and nothing to connect. The new variable sits alongside the original, ready for Data Explorer, dashboards and everything else that reads the data store.


Every Recode has one source variable and creates one output. You choose the kind of output with Variable Type:

Variable TypeWhat it’s forWhat it creates
Categorical (the default)“Countable, filterable, and crosstabable output with labelled codes.” For example, 1 = Detractor, 2 = Passive, 3 = Promoter.An Integer variable. Your codes and labels become its codeframe.
Numeric”Averageable score output with a Scale measure and numeric values.” For example, turning answers into points you can average.A Number variable
Text”Templated text output with optional interpolation from eligible Data Store variables.” For example, a readable label built from other variables.A Text variable

The source can be a Text, Long Text, Integer, Number or Boolean variable. It can’t be:

  • a Date, Date Time, Time, Guid or Multi-Response variable
  • a variable whose personal information is set to Mask, Mask + retention or Wipe

Recodes work on draft and published data stores, and on survey data stores. In a survey data store, you can recode the survey’s variables, but you can’t overwrite source survey variables.

A Recode runs once, when you click DONE. It doesn’t run again by itself when new records arrive or the source changes.

If the source variable changes after a Recode has run, the output variable is tagged STALE in Variable View: “The source changed after this action ran. Reopen it to run again.” See Reopen or run a Recode again.


You can start from the toolbar or from the variable itself.

  1. Open Variable View - On the data store page, click the Variable View tab.
  2. Click Add Variable - The Add Variable dialog asks you to “Choose how you’d like to create your new variable”, with a search box above the options.
  3. Choose Recode - Click the Recode card, “Create a new variable by transforming values from an existing variable.”, then click SELECT. The Recode window opens full screen.

Or, in Variable View, click the Recode Variable icon on the row of the variable you want to recode. The Recode window opens with that variable already chosen as the source.

If the Recode card is locked, the data store has nothing you can recode: “Recode requires at least one eligible source variable in this data store.” See Which variables you can recode.

The Recode window has two steps, Source & output and Build rules. Use NEXT and BACK to move between them. NEXT stays disabled until the current step is complete.


Under Choose Your Inputs, drag a variable from Available Variables into Selected Variables. A Recode takes one source variable.

Data Wrangler loads a sample of up to 1,000 records from the source, which it uses to preview your rules. You’ll see “Loading a stable source sample…” while it loads. The sample doesn’t use any Data View filters.

Under Define the Output, choose a Destination: “Where should we save the recoded result?”

  • New Variable (the default): “Create a new variable for the results”.
  • Overwrite Existing: “Write the results over an existing variable”. See Overwrite an existing variable.

For a new variable, check or change these fields. Data Wrangler fills them in for you from the source:

FieldWhat to enter
New Variable NameThe system name. It’s filled in for you from the source, for example nps_band for a Categorical Recode of nps. It must start with a letter and use only letters, digits and underscores, up to 100 characters.
Variable LabelThe friendly name people see. It’s suggested from the source’s label (or its name, if it has no label) plus “band”, “score” or “label”, for example “AGE band”. Change it to whatever reads best.
Variable TypeCategorical, Numeric or Text. See What you can create.

The suggested name ends in _band for Categorical, _score for Numeric and _label for Text, and the suggested label ends in the same word. If the name is already taken, you’ll see “This name already exists. Choose a numbered alternative:” with some suggestions. Click one to use it, or type your own.

You can switch Variable Type later. If you’ve already added rules, you’ll be asked “Switch this draft to … output?” Click Switch or Cancel. Each type keeps its own rules, so switching back brings yours back.

Click NEXT.

Choose Overwrite Existing to put the results into a variable you already have. Choose it from Overwrite Target, then type its name in Type the target name to confirm.

You can only overwrite a variable that:

  • was added in Data Wrangler, not by a survey
  • isn’t the primary key, a multi-response variable or one of its child variables
  • isn’t set to Mask, Mask + retention or Wipe
  • matches the output type: Integer for Categorical, Number for Numeric, or Text for Text

If nothing qualifies, Overwrite Existing is unavailable.


On the Rule Builder tab, each rule says “if the source is this, the output is that”. Rules are checked from the top down, and the first rule a record matches wins. Records that match no rule fall to Else.

  1. Click Add Rule - Until you add one, the tab shows “No rules yet” and “Add your first rule to start mapping values to codes.” Click Add Rule and Rule 1 appears.
  2. Set the condition - Under IF, choose an Operator and enter the Value (or From and To for Between, or Values for In). The Variable is always your source.
  3. Set the result - Under THEN CODE, enter what matching records get. See Results by type.
  4. Add more rules - Click Add Rule for each group you need. Use Move rule up and Move rule down to change the order, and Delete rule to remove one.
  5. Check Else - Decide what happens to everything else. See Else: everything that doesn’t match.

Each rule shows how many sample records it catches, for example “312 rows · 31.2%”.

Each rule has one condition. The operators depend on the source:

OperatorMatchesAvailable for
Equal / Not EqualOne value, or everything except itAll sources
InAny of several Values. Tick Include system-missing in this bucket to include blanks too.All sources
Is Missing / Is Not MissingBlank values, or anything that isn’t blankAll sources
Less Than, Less Than or Equal, Greater Than, Greater Than or EqualValues below or above a numberInteger and Number sources
BetweenValues from From to To, including bothInteger and Number sources
Variable TypeFields under THEN CODE
CategoricalCode (a whole number) and Label
NumericValue and an optional Description
TextText template: the text to write. Type @ to pick another variable and include its value, for example @region.

In a Categorical Recode, give the same code the same label every time. If two rules share a code, their labels must match.

The Else row, “Else — all other rows”, is always last. It catches “Rows matching no rule above, or with a null in any input”.

By default, Else gives a blank: NULL for Categorical and Numeric, or an empty string for Text. To give these records a result instead, click Use a code, Use a value or Use text and fill it in. Click Use NULL to go back to a blank.

When Else is left on NULL, the Codeframe panel reminds you: “The Else rule outputs NULL, so it has no code-frame entry.”

For a Numeric Recode from a number, you can also keep each record’s original value, but only on the Syntax tab. See ELSE.

As you build, three panels update from the sample:

PanelWhat it shows
CodeframeFor Categorical Recodes, each code and its label: “One label per distinct code”
CoverageHow the sample records are spread across your rules and Else
Live PreviewSample records side by side: the source value and the result it gets

If records match more than one rule, you’ll see Overlapping coverage. That’s a warning, not an error: those records get the first rule they match. Reorder your rules if the wrong one is winning.


To turn a 0–10 Integer score called nps into NPS groups:

  1. Choose the source and output - Drag nps into Selected Variables. Keep New Variable and Categorical, and set Variable Label to “NPS group”.

  2. Add the rules - On Build rules, add these three rules:

    RuleOperatorValueCodeLabel
    Rule 1Between0 to 61Detractor
    Rule 2Between7 to 82Passive
    Rule 3Between9 to 103Promoter
  3. Leave Else on NULL - Anyone without a score stays blank.

  4. Click DONE - The new variable is created and the Recode starts running.


  1. Click DONE - You’ll see “Creating Recode”, then “Recode queued”: “Recode saved and queued. It will continue running in the background.”
  2. Watch for RUNNING - The output variable appears in Variable View straight away, tagged RUNNING: “This action is executing.” You can carry on working, or leave the page.
  3. Check it finished - When it’s done, a Recode complete message tells you, for example, “Created nps_band. Variable View has been refreshed.” Click OK.

A quick Recode can finish before you see the first two messages or the RUNNING tag. That’s fine: the Recode complete message is the one that counts.

DONE stays disabled until the rules are complete. A Recode needs at least one rule, so you can’t send everything to Else. A list headed “Complete the required fields to finish:” tells you what’s missing.

If you leave and come back while a Recode is running, Variable View picks it up again and shows RUNNING until it finishes.


Reopen a Recode to change its rules or its Variable Label, or to run it again after the source has changed (it’s tagged STALE).

  1. Open the Recode - Click the Reopen Recode / Run again icon on the output variable’s row, or use Reopen in Manage Actions. The Reopen Recode window opens.
  2. Make your changes - You can change the Variable Label and the rules. The source, the Variable Type and the destination are locked.
  3. Click RUN AGAIN - You’ll see “Running Recode again” (“Saving the existing definition and creating a new execution.”), then “Recode queued again” (“Recode queued again. It will continue running in the background.”). The output is recalculated for every record, and you’ll see the same Recode complete message as for the first run. The STALE tag clears.

To recode from a different source, or into a different type or variable, start a new Recode.


Manage Actions lists every Recode and Compute in the data store and every time one has run. Click Manage Actions in the Variable View toolbar. It’s unavailable until the data store has at least one Recode or Compute. For how Computes appear here, see Compute variables.

Recodes are grouped by their source variable. Each shows its Output and its Status:

StatusWhat it means
PendingQueued, waiting to run
RunningRunning now
SucceededFinished
Succeeded — source changedFinished, but the source has changed since. The output is tagged STALE.
Succeeded — metadata warningThe values were written, but the output variable’s details weren’t fully updated
FailedDidn’t finish. See Common Issues and Solutions.

Use the Status filter to show only some of them. On a Recode that isn’t queued or running:

  • Run again runs it straight away with the same rules. There’s no confirmation.
  • Reopen opens it so you can change the rules first. See Reopen or run a Recode again.

The Audit tab lists every run in the data store, newest first, with its Action, Input, Output, Status and Timestamp. A first run and a later run both show “Recode” as the Action.


Does a Recode update when new data comes in?

No. A Recode runs once, when you click DONE or RUN AGAIN. If the source changes afterward, the output is tagged STALE. Reopen it and click RUN AGAIN to bring it up to date. For a recode that runs every time, use a wrangle’s Recode step.

Why can’t I see my variable in Available Variables?

It’s a type Recode can’t read (Date, Date Time, Time, Guid or Multi-Response), or its personal information is set to Mask, Mask + retention or Wipe. See Which variables you can recode.

Can I recode a published data store?

Yes. Creating and editing Recodes stays available after you publish.

Can I recode a survey’s variables?

Yes. You can use any eligible survey variable as the source. You can’t overwrite a survey’s variables, though, so the result goes into a new variable or one you’ve added in Data Wrangler.

Can I use two variables in one rule?

No. A Recode has one source, and each rule has one condition on it. You can pull other variables’ values into a Text result with @, but they can’t decide which rule matches.

What happens to records that don’t match any rule?

They fall to Else, which leaves them blank unless you choose Use a code, Use a value or Use text. Records with a blank source also fall to Else, unless a rule catches them with Is Missing or Include system-missing in this bucket.

Why are the preview numbers different from my whole data store?

The preview uses a sample of up to 1,000 records. When the Recode runs, it uses every record.

Does a Categorical Recode create a codeframe?

Yes. Your codes and labels become the new variable’s codeframe, so other apps show “Promoter” rather than 3. You can change it afterward in Codeframes.

Can I change a Recode’s source or type after it’s run?

No. When you reopen a Recode, the source, Variable Type and destination are locked. Start a new Recode instead.

What’s the difference between this and the wrangle Recode step?

This Recode works inside one data store, runs once, and gives you a preview as you build. A wrangle’s Recode step runs every time the wrangle runs and can write to another data store, but it has no preview. See Recode data.

Why don’t I see Add Variable or Manage Actions?

You can only view this data store. Ask the owner for Can Edit access.


”This name already exists. Choose a numbered alternative:”

Section titled “”This name already exists. Choose a numbered alternative:””

Another variable already has the name in New Variable Name.

  1. Pick a suggestion - Click one of the numbered names shown under the message.
  2. Or type your own - Choose a name no other variable uses.

”Complete the required fields to finish:”

Section titled “”Complete the required fields to finish:””

DONE is disabled because part of a rule or the output isn’t filled in. The list says what’s missing, for example “Between needs a lower and an upper value.” or “A label is required.”

  1. Read the list - Each item points to the field to fix.
  2. Fill it in - Check each rule’s IF and THEN CODE fields, and the Else row.

The Recode didn’t finish. The message says why, where it can. If you were overwriting a variable, its old values are kept.

  1. Read the message - It may tell you what to fix, such as a rule or a variable used in a Text template.
  2. Run it again - Open Manage Actions and click Run again, or reopen the Recode and click RUN AGAIN.
  3. Contact support - If it keeps failing, contact support with the data store’s name and GUID (copy it from Settings).

“The source changed after this action ran. Reopen it to run again.” The output may be out of date. In Manage Actions, the Recode shows Succeeded — source changed.

  1. Reopen the Recode - Click Reopen Recode / Run again on the output variable’s row.
  2. Click RUN AGAIN - The output is recalculated from the current data.