Search code examples
spss

Removing observations from SPSS Dataset


I would like to delete some observations from the table in my SPSS, if values meet, for instance:

If product + value from column meet, I want to remove it/make it SYSMIS (only this observation, the observation from another column for this row needs to be still available, so make flag and temporary select is not enough)

Tried several approaches like:

    RECODE VAR2(If(PRODUCT=1 AND VAR2=2000) = SYSMIS)(ELSE=COPY)
EXECUTE.

 IF(PRODUCT=1 AND VAR2=2000) RECODE VAR2(SYSMIS)(ELSE=COPY)
EXECUTE.

None of it works

Is there a way to remove observations in another way than delete it from raw data? I'd like to avoid it


Solution

  • You might save a lot of work by looking up some basic spss syntax tutorials. See here for a good site.

    In the present case all you need is this:

    If PRODUCT=1 AND VAR2=2000 VAR2=$SYSMIS.
    

    To make your syntax work with recode, you can do this:

    DO IF (PRODUCT=1 AND VAR2=2000).
      RECODE VAR2 (ELSE=SYSMIS).
    END IF.