buttonsrtoys
buttonsrtoys

Reputation: 2771

How to extract a subset of SPSS data based on variable values?

I have a large SPSS file with a couple dozen variables. The first variable is a unique ID. I'd like to generate a CSV or TXT file that contains a list of all the IDs whose variables match certain values. I don't need the values just the list of IDs.

So, if my variables are ID, A, ..., Z, I'd like a list of values for ID where B=1, F=3, and M > 0. I don't care about the values of the other variables and don't need to save them to file.

Upvotes: 1

Views: 1244

Answers (1)

eli-k
eli-k

Reputation: 11310

This should do it:

temp.
select if B=1 and F=3 and M > 0.
save translate outfile='yourpath\yourfilename.csv' /type=csv /keep=ID.

Upvotes: 2

Related Questions