Question: How to store each subset after splitting a file
Question: Hi all!
After a SPLIT command applied to my file, I would like each generated subset
of data to be saved in a different .sav file.
Is there an easy way to do that using SAVE or XSAVE?
Even if SPSS can manage each subset separately, I did not find how to save
each subset separately.
Do not hesitate if I am not clear enough or if you need more information.
My data is organized as follows:
Source Destination other variable
david Stefan 123
Nico Bruce 213
Nico Stefan 333
Stefan Nico 2
david Stefan 5
Stefan Nico 56
I want to split my file according to each unique combination
, hence, I use:
SPLIT FILE SEPARATE BY Source Destination.
Hence I have my data sorted as I need:
Source Destination other variable
david Stefan 123
david Stefan 5
Nico Bruce 213
Nico Stefan 333
Stefan Nico 2
Stefan Nico 56
Now, what I need, is to have all the records for each distinct pairto a different file.
Assuming that my first file is called file.sav, I would like to have:
file_david_Stefan.sav with all records with
file_Nico_Bruce.sav with all records with
file_Nico_Stefan.sav with all records with
and so on…Thanks you for your help.
Answer: Here is the better way.DO IF source=?david? and destination=’Stefan’.
XSAVE OUTFILE=?file_david_Stefan.sav?.
ELSE IF source=?Nico? and destination=’Bruce’.
XSAVE OUTFILE=?file_Nico_Bruce.sav?.
ELSE IF…
etc.
Do you also need an answer on your spss question, submit your question here.
2 comments March 26th, 2006