If you check www.spss.com
and the support area you might find syntax or macro to help. Depending on the SPSS version you are running there is Python for this.
See the note below
NOTE: Please read the Posting Guidelines and always tell us your OS, the SPSS version and information about your study and data!