Delete variables that have only missing values
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 | *(Q) How can I delete variables whose values are all missing. *(A) Solution posted to SPSSX-L list by Simon Freidin on 2004/01/17. set printback=listing. data list list/v1 to v5. begin data. 1 0 . 0 . 0 0 . 0 . 0 2 . 0 . end data. save outfile='c:\\temp\\origdata.sav'. flip. count allmiss=var001 to var003 (sysmis). /* change var003 for number of cases */ select if allmiss=3. /* change 3 for number of cases */ do if $casenum=1. write outfile='c:\\temp\\select.sps'/"get file='c:\\temp\\origdata.sav'/drop=". end if. write outfile='c:\\temp\\select.sps'/" " case_lbl. exe. include file='c:\\temp\\select.sps'. exe. |
Related pages
...