Recode and compute new variables

Recode variables and compute new, derived variables right in the codebook — via SQL with {{=SUM(...)}}, {{=ROUND(...)}} and CASE WHEN, with no detour through SPSS.

Codebook with derived variables in DataLion

DataLion recodes variables and computes new, derived variables right in the codebook — via SQL with functions like SUM, ROUND, AVG and COUNT DISTINCT plus CASE-WHEN logic. The prep happens on the dataset, with no detour through SPSS or Excel.

  • 🇩🇪 Made in Munich
  • GDPR-compliant
  • DPA included
  • Hosted in Germany

Trusted by research, insights & media teams

  • YouGov
  • SevenOne Media
  • Mediengruppe RTL Deutschland
  • Nielsen Sports
  • mobile.de
  • 50+ interactive chart types
  • 20+ statistical methods (R)
  • 2 weeks release cadence
  • ISO 27001 certified data centers (Germany)

Recode variables

Collapse answers, flip scales or build groups: in DataLion you recode variables without changing the raw dataset or re-running fieldwork.

With CASE WHEN you map the logic exactly — say “1 to 3 → top, 4 to 5 → flop” — and the result is instantly available as a new category.

  • Collapse answers and flip scales
  • Conditional recodes via CASE WHEN
  • No change to the raw dataset required
Recoded variable as a table in DataLion

Compute new variables via SQL

Compute new, derived variables right in the codebook — via SQL with functions like {{=SUM(...)}}, {{=ROUND(...)}}, AVG, COUNT and COUNT DISTINCT.

That turns indices, sum scores or averages into their own variables — computed from your raw data, not hand-built in Excel.

  • Derived variables right in the codebook
  • Functions SUM, ROUND, AVG, COUNT DISTINCT
  • Indices and sum scores as their own variables

In the codebook, not in SPSS

Because recodes and computations live centrally in the codebook, you need no export to SPSS or Excel — and no scripts maintained somewhere on the side.

That keeps your prep traceable and consistent across waves: defined once, applied the same way everywhere.

  • Recodes maintained centrally in the codebook
  • No export to SPSS or Excel
  • Applied consistently across all waves
Derived variable as a chart in DataLion

See DataLion with your own data

Start a free trial or book a personal demo — from raw data to a finished dashboard.

We now work much more efficiently, giving us more time to take care of the derivations and insights from the data for the customers.
Jens Falkenau, Vice President of Market Research · Nielsen Sports
Read the case study →

More data preparation

Common questions about recoding

Can I recode variables in DataLion?
Yes. You collapse answers, flip scales and build groups — via CASE-WHEN logic right in the codebook, without changing the raw dataset.
How do I compute new variables?
You compute derived variables via SQL right in the codebook, with functions like {{=SUM(...)}}, {{=ROUND(...)}}, AVG, COUNT and COUNT DISTINCT — say for indices, sum scores or averages.
Do I need SPSS or Excel to recode?
No. Recodes and computations live centrally in the codebook, so there’s no export to SPSS or Excel and no scripts maintained on the side.
Do recodes stay consistent across multiple waves?
Yes. Because recodes and computations are defined once in the codebook, DataLion applies them consistently across all waves — traceable and with no manual re-doing.

Recode without switching tools

Try DataLion free: recode variables and compute new ones via SQL in the codebook — with no export. Or book a personal demo.