Last observation carried forward is often used in clinical trials to conservatively replace missing values in longitudinal studies.
Special care needs to be taken when doing this in SPSS See here. If this link is broken details are as below:
In this simple example, variable B will get a value of 10, if A=1, otherwise B is assigned a value of 20, but only for valid values; for user missing or system missing cases, the result will be SYMIS. In SPSS the result of a logical expression is in fact true, false or missing. In the case of a missing value, SPSS skips everything between DO IF / END IF.
DO IF A=1. COMPUTE B=10. ELSE. COMPUTE B=20. END IF. EXECUTE.
Using the above syntax 9 is declared missing (user missing on variable A)
A B 1 10 1 10 2 20 2 20 . . 8 20 9 .
If you wish to treat missing values differently, you must use one of the missing value functions in the logical expression on the DO IF command, i.e. you must first test for missing values, if you wish to apply a special treatment on them, i.e.
The test for missing values must be on the DO IF command if you wish to handle the missing values. (the MISSING() function is true if observation has a user or system missing value. You can use the SYSMIS() function to check specifically for system missing values.
DO IF MISSING(A). COMPUTE B=-1. ELSE IF A=1. COMPUTE B=10. ELSE. COMPUTE B=20. END IF. EXECUTE.
Using this syntax 9 is declared missing (user missing on variable A)
A B 1 10 1 10 2 20 2 20 . -1 8 20 9 -1
The example below does NOT work.
For a case with a missing value, the result of the test A=1 on the DO IF command will yield a missing value, i.e. SPSS will skip to END IF (i.e. the ELSE IF condition here will never be true) and do nothing at all with it. If variable B does not exist, its value will be SYSMIS; if B exists, the value for that case will not be changed.
The results will be identical to the very first example where missing values were not checked for at all!
DO IF A=1. COMPUTE B=10. ELSE IF MISSING(A). COMPUTE B=-1. ELSE. COMPUTE B=20. END IF. EXECUTE.