Written and maintained by CASRAI Editorial Board
Last updated
Two Ways to Recode a Variable in SPSS
SPSS puts recoding under Transform in the main menu of IBM SPSS Statistics, and it offers two commands that look almost identical but behave very differently: Recode into Same Variables and Recode into Different Variables. Both open the same underlying dialog for defining old-to-new value mappings (collapsing a continuous age variable into age bands, combining sparse Likert categories, reverse-scoring an item, converting string codes to numeric codes). The difference is entirely in where the result is written.
- Recode into Same Variables overwrites the values in the variable(s) you selected. The original, un-recoded data is gone from the active dataset the moment you click OK.
- Recode into Different Variables writes the recoded values into a brand-new variable you name, leaving the source variable completely untouched.
For almost every real analysis workflow, Into Different Variables is the correct default, and the rest of this guide explains why, walks through the Old and New Values dialog that both commands share, and covers the specific way Into Same Variables causes irreversible data loss.
Recoding is most often used to convert a continuous or fine-grained variable into a smaller set of categories — see levels of measurement for why that conversion changes what statistical tests are appropriate. A recoded grouping variable is typically the input to a one-way ANOVA, an independent-samples t-test, or a chi-square test of independence once the banding is complete.
Why Into Different Variables Should Be Your Default
Three practical reasons make this the safer choice in almost every case:
- It preserves an audit trail. Your saved
.savfile still contains the original variable exactly as it was collected, alongside the derived one. If a reviewer, co-author, or your own future self needs to check how a recode decision was made, or wants to re-derive the grouping with different cut points, the raw values are still there to check against. - It’s forgiving of mistakes. Recoding is easy to get wrong on the first attempt — an off-by-one range boundary, a missing-value code accidentally swept into a real category, a reversed scoring direction. When the output lands in a new variable, you just delete that variable and run the recode again. When it overwrites the source variable, the only way back is reloading from a saved backup of the file — if one exists.
- It matches good research-data-management practice. Treating raw data as read-only and building derived variables alongside it is the same principle behind keeping a clean, unmodified master copy of any dataset. Recoding into a new variable is the SPSS-dialog-level version of that discipline.
The cost of the safer choice is close to zero: naming a new variable (e.g. age_group next to age) takes one extra text field in the dialog, and a codebook with both the raw and derived variable is more useful, not less, than one with only the derived version.
The Old and New Values Dialog, Step by Step
Both Recode commands open the same core workflow:
- Select the source variable(s) and move them into the “Input Variable” box. For Into Different Variables, you’ll also type an “Output Variable” name in the box on the right and click Change to attach it — this step is easy to skip by accident, and if you do, the recode silently has nowhere to write its output and SPSS will flag the missing output name when you try to continue.
- Click Old and New Values to open the mapping dialog. This is where the actual recode logic is defined.
- Define each mapping on the left (“Old Value”) and right (“New Value”) sides:
- Value — a single exact old value mapped to a single new value.
- Range, LOWEST through value and Range, value through HIGHEST — open-ended bands, useful for the top/bottom category of a collapsed scale.
- Range, value through value — a closed interval, the usual choice for banding a continuous variable (e.g. 18 through 29 → 1).
- All other values — a catch-all for anything not matched by an earlier rule; place it last, since SPSS evaluates the Old → New list top to bottom and stops at the first match.
- Click Add after each mapping to move it into the Old → New list. A mapping typed into the fields but never added is silently discarded when you click Continue — it will not appear in the output.
- Click Continue, then OK (or Paste to generate syntax instead of running immediately — see below).
One detail worth checking before you run it: for Into Different Variables, the new variable’s measurement level and value labels are not inherited automatically. Assign value labels to the new categories in Variable View afterward (e.g. 1 = “18–29”, 2 = “30–49”), or the Frequencies and Descriptives output will show bare integers instead of readable category names.
Handling Missing Values in a Recode
The Old Value side of the dialog has a specific option for System- or user-missing values, separate from the “All other values” catch-all. This distinction matters:
- If you leave missing values unmapped and use “All other values” as a catch-all, SPSS’s system-missing and any user-defined missing codes get swept into whatever new value you assign to “all other” — silently converting a genuinely missing observation into a real, analyzable category. This is a common source of a subtly wrong denominator in downstream frequency tables.
- To keep missing values missing, add an explicit mapping: Old Value → “System- or user-missing” → New Value → “System-missing”, and place this rule before (or instead of relying on) “All other values” catching it first.
- If a value should be treated as missing only in the new variable, not the original, define it as a new value and then set it as user-missing on the new variable afterward, in Variable View → Missing.
This is one more reason Into Different Variables is the more defensible choice: because the source variable is untouched, an error in how missing values were handled during the recode is fully correctable by re-deriving the output variable, without any risk to the original responses.
The Data-Loss Risk of Recoding into the Same Variable
Recoding into the same variable is a genuinely destructive operation, and SPSS gives no in-dialog warning that distinguishes it from the non-destructive version. Consider a common case: a researcher has a continuous age variable and wants an age-band version for a crosstab. Using Recode into Same Variables on age directly replaces every respondent’s exact age with a 1/2/3/4 band code the moment OK is clicked. If the dataset is then saved, the original ages are gone from that file permanently — not just hidden, not recoverable through Edit → Undo once the session that performed the recode has ended, and not recoverable at all if no separate backup copy of the file exists.
The failure mode that actually catches people is not “I meant to keep the original” in the abstract — it’s a downstream analysis that turns out to need the original continuous variable after all (a correlation, a regression, a different banding scheme for a reviewer’s requested sensitivity check), discovered only after the file with the intact data has already been overwritten and saved. Into Same Variables is not a mistake by itself; the mistake is using it on a variable whose original values might ever be needed again, which in practice is almost every variable in a research dataset.
When Into Same Variables Is Actually Appropriate
There are a small number of legitimate uses, generally where the “old” values are already known to be disposable:
- Cleaning up an already-derived, throwaway variable you created moments earlier purely as an intermediate step, and have no reason to keep in its pre-recode form.
- Standardising string case or coding inconsistencies (e.g. “Y”/”y”/”Yes” → “Y”) in a variable that is itself a working copy, with the true source data preserved elsewhere.
- A one-off exploratory session on a copy of the dataset that will never be saved over the master file.
Outside of cases like these, treat Into Same Variables as the exception that needs a specific justification, not the default click.
The Syntax Equivalent
Clicking Paste instead of OK in either dialog generates the underlying RECODE command, which makes the same distinction explicit in syntax:
RECODE age (18 THRU 29=1) (30 THRU 49=2) (50 THRU 69=3) (70 THRU HIGHEST=4) (ELSE=SYSMIS)
INTO age_group.
VARIABLE LABELS age_group 'Age group (recoded)'.
VALUE LABELS age_group 1 '18-29' 2 '30-49' 3 '50-69' 4 '70+'.
EXECUTE.
The INTO age_group clause is what creates the new variable — omit it, and the same RECODE syntax overwrites age in place, exactly matching Into Same Variables. (ELSE=SYSMIS) is the syntax-level equivalent of explicitly mapping “all other values” (including missing) to system-missing rather than letting them fall through unhandled. Because syntax is saved, re-runnable, and self-documenting, pasting the syntax rather than only running the dialog once is worth doing even for a one-off recode — it becomes a permanent, auditable record of exactly how the derived variable was built, which is useful for a methods write-up or a data dictionary regardless of which recode command produced it.
Frequently Asked Questions
Does SPSS warn me before Recode into Same Variables overwrites my data?
No. There is no confirmation prompt distinguishing it from Into Different Variables — clicking OK applies the recode immediately to the selected variable(s) in the active dataset. The only protection is a saved backup copy of the file from before the recode was run.
Can I undo a Recode into Same Variables after saving the file?
Not through SPSS’s Edit → Undo, which only covers actions within the current, unsaved session. Once the file has been saved and the session closed, the original values are recoverable only from a separate backup copy made before the recode.
Why does my recoded variable show numbers instead of category labels?
Value labels are not generated automatically. After running either Recode command, go to Variable View and add value labels to the new (or overwritten) variable manually, or add a VALUE LABELS line to the pasted syntax.
What happens to missing values if I only define “All other values” and no explicit missing rule?
They get swept into whatever new value “All other values” is mapped to, converting genuinely missing observations into a real category. Add an explicit “System- or user-missing” rule before relying on a catch-all if you want missing values to stay missing.
Is there a way to recode multiple variables at once?
Yes — both dialogs accept multiple input variables. For Into Different Variables, each input variable needs its own output variable name (select one input at a time, type its output name, click Change, repeat), and the same Old and New Values rules are applied to all of them.








