Keep only cases from Master file whose id are in second file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | *(Q) I have a data base (a *.sav file) with an id. There is also second *.sav file containing a list of id which must be selected from the data base, How can I do that. *(A) Posted to SPSSX-L list by rlevesque@videotron.ca on 2002/10/15. DATA LIST LIST /id data1 TO data4. BEGIN DATA 1 1 1 1 1 1 2 1 1 2 2 1 1 1 3 2 2 2 2 4 3 1 1 1 1 END DATA. LIST. SORT CASES BY id. SAVE OUTFILE='c:\\temp\\database.sav'. DATA LIST LIST /id. BEGIN DATA 1 3 END DATA. LIST. SORT CASES BY id. SAVE OUTFILE='c:\\temp\\id to keep.sav'. ***** Start job. GET FILE='c:\\temp\\database.sav'. MATCH FILES /FILE=* /TABLE='C:\\Temp\\id to keep.sav' /IN=keepcase /BY id. * Next lines deletes unwanted cases. SELECT IF keepcase=1. * Delete the variable keepcase. MATCH FILES FILE=* /DROP=keepcase. |
Related pages
...