l0feic
l0feic

Reputation: 27

SPSS delete variables (filter)

I want to delete most of my variables from my SPSS data file.

However, I have following filter: any(pui, 419, 1018, 1108, 1204, 1511, 2004, 2612)

These parties (party unique identifier), as well as some categories concerning party positions (e.g. S16_09) must not be deleted - however, when I enter following code

delete variables
...
.

and exclude the variables I want to keep (the parties mentioned above, as well as some other like S16_09, S18_14, S13_19), all necessary variables are kept except the filter. Can you please help me?

The parties should be in the rows, whereas the different categories are in columns.

Thanks for your help! In case you have any questions pls let me know.

Upvotes: 0

Views: 522

Answers (2)

eli-k
eli-k

Reputation: 11350

If you have more variables to delete then keep, this is a better way to do this (and you can filter before deleting the variables and still keep your filter):

compute myfilter=any(pui, 419, 1018, 1108, 1204, 1511, 2004, 2612).
add files /file=* /keep pui S16_09 S18_14 S13_19 myfilter.
exe.

Upvotes: 1

l0feic
l0feic

Reputation: 27

already have an answer, in case someone has the same problem

First delete the variables, then filter for relevant parties. It does not work the other way round.

Upvotes: 0

Related Questions