SPSS command: SPSS RMV
Replace missing values in a series
Replace Missing Values fills gaps in a variable treated as a series in case order, creating a new variable and leaving the original untouched.
Free · No account · Files stay on your device · Updated 18 October 2026
What it tells you
Crosstabs offers the five SPSS RMV functions (SMEAN, MEAN, MEDIAN, LINT and TREND), a preview of every replaced value and a CSV download with the new columns.
- The value each method puts into every gap, side by side with the missing source value.
- How many values were replaced and how many stay missing because no estimate is possible, such as a gap at the start of the series for interpolation.
- The first and last non-missing case and the SPSS-style creating function, e.g. MEAN(sales,2).
When to use it
Use it when
- A time-ordered series (daily sales, monthly counts) with occasional gaps before forecasting or charting.
- A quick, transparent fill where a neighbour-based value is defensible and you want the method written next to the new variable.
Use something else when
- Cross-sectional survey data where row order means nothing: neighbour-based methods are meaningless there; use Multiple Imputation.
- When you need valid standard errors after filling: single imputation understates uncertainty, so pool multiple imputations instead.
- Long runs of missing values: interpolation across them invents a straight line; consider a time-series model.
How to run it in Crosstabs
- 01
Sort the data, then open it
Cases are treated as a series in their current order (case number = row number), so make sure rows are in time order before opening the file in Statistics mode.
- 02
Choose Replace Missing Values
In the Missing values group, pick Replace Missing Values (RMV) and tick one or more Series variables.
- 03
Pick the method
Method: Series mean (SMEAN), Mean of nearby points (MEAN), Median of nearby points (MEDIAN), Linear interpolation (LINT) or Linear trend at point (TREND). For the nearby-point methods set Span of nearby points (each side), default 2, or tick Use all points.
- 04
Name the new variables
Under New variable names, keep the SPSS-style default (source name plus _1) or type your own; a name already in the file is rejected.
- 05
Preview and download
Press Preview to see the Result Variables and the replaced values, then Download data with new variables (CSV). The source data are never changed.
Worked example
Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.
Data
A 20-day series of website visits typed in case order, with values missing on days 1, 4, 9, 10 and 16. The series is small enough to show every replaced value.
Input preview
| Day | visits |
|---|---|
| 1 | . |
| 2 | 132 |
| 3 | 128 |
| 4 | . |
| 5 | 141 |
| 6 | 139 |
| 7 | 150 |
| 8 | 147 |
| 9 | . |
| 10 | . |
| 11 | 158 |
| 12 | 163 |
| 13 | 160 |
| 14 | 171 |
| 15 | 168 |
| 16 | . |
| 17 | 175 |
| 18 | 181 |
| 19 | 178 |
| 20 | 186 |
| Creating Function | N of Replaced Missing Values | First Non-Missing Case | Last Non-Missing Case | N of Valid Cases |
|---|---|---|---|---|
| SMEAN(visits) | 5 | 1 | 20 | 20 |
| MEAN(visits,2) | 4 | 2 | 20 | 19 |
| LINT(visits) | 4 | 2 | 20 | 19 |
| TREND(visits) | 5 | 1 | 20 | 20 |
| Case | visits | Series mean | Mean of nearby points (span 2) | Linear interpolation | Linear trend at point |
|---|---|---|---|---|---|
| 1 | . | 158.5 | — | — | 126.9 |
| 4 | . | 158.5 | 135.0 | 134.5 | 136.0 |
| 9 | . | 158.5 | 154.5 | 150.7 | 151.3 |
| 10 | . | 158.5 | 154.5 | 154.3 | 154.4 |
| 16 | . | 158.5 | 173.8 | 171.5 | 172.7 |
— means the method cannot produce an estimate there, so the value stays missing.
How to read it
The series mean puts the same 158.5 into every gap, ignoring the upward drift. Linear interpolation fills the two-day gap on days 9–10 with 150.7 and 154.3, on the line between its neighbours, but cannot fill day 1 because there is no earlier value (1 value stays missing). The linear trend fits the whole series and estimates day 1 at 126.9.
Output tables explained
- Result Variables
- Per new variable: number of replaced missing values, first and last non-missing case, number of valid cases and the creating function. Footnotes list values that stay missing.
- Preview of replaced values
- Every case (up to the first 50) where a source value was missing, with the source value shown as "." and the new value beside it.
Assumptions and notes
- Row order is the time order; the procedure has no date variable of its own.
- LINT and the nearby-point methods need valid values on both sides of a gap, so gaps at the start or end of a series can stay missing; SMEAN and TREND fill every gap.
- The replaced values are single estimates, so any later standard error treats them as if they had been observed.
How the results are validated
LINT, TREND, SMEAN, and the mean and median of nearby points (spans 1, 2, 3 and all) are checked against independent Python references — pandas interpolate for LINT, numpy polyfit for TREND and independent code for the nearby-point methods — and agree to 1e-12. Tests also confirm SPSS-style result names and that the source column is never changed. Validation evidence
Questions
Which method should I use?
Linear interpolation is a good default for smooth series with short gaps. The median of nearby points resists outliers, the linear trend suits a steady drift, and the series mean is only sensible for a series with no trend.
Why does a value stay missing?
Interpolation and the nearby-point methods need data on both sides of the gap; a gap at the very start or end has nothing on one side. A footnote lists how many values stay missing.
Does it change my dataset?
No. The workspace data stay as they are; the new variables appear in the preview and in the downloaded CSV.
What does the span do?
For the mean or median of nearby points, the span is how many valid values on each side are used. Span 2 uses two before and two after; Use all points uses the whole series.
Related procedures
- Multiple ImputationMULTIPLE IMPUTATION
- Missing Value AnalysisMVA
- Create Time SeriesCREATE
- Time Series Forecasting (Expert Modeler)TSMODEL
- Exponential SmoothingEXSMOOTH
- Free SPSS alternative: full coverage list
Run Replace Missing Values on your own data
Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.
SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.