Dear SPSS Lister:
I have a variable in a dataset which have a column named Month as follow RecordNumber Month 1 1 2 2 3 5 4 12 Could you tell me how I use SPSS to find and replace the 1 to January, 2 to February, 3 to March...... 12 to December. Thanks for your help! Hans Chen |
Hi Hans,
For "hard" replacement, one uses RECODE (Menu Transform->Recode->Into different variables). But in most cases it is better to leave the data untouched and use Value labels. In the data editor, choose the Variable View, find the variable and click in the column values. And then fill in pairs "value - label" (e.g. Value 1, label January) and click Add after each pair. Then in the output, if you wish, ones will be replaced with "January" etc. It is good to read the section about value labels in a manual (how to turn them off, how to change them etc.). Or ask here for further details. HTH Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of SPSS Chen Sent: Thursday, November 23, 2006 3:46 AM To: [hidden email] Subject: Find and Replace Dear SPSS Lister: I have a variable in a dataset which have a column named Month as follow RecordNumber Month 1 1 2 2 3 5 4 12 Could you tell me how I use SPSS to find and replace the 1 to January, 2 to February, 3 to March...... 12 to December. Thanks for your help! Hans Chen |
In this particular instance, you could just apply the Month format, as in:
formats monthvar (month9). The only drawback is that month names are displayed in all upper case. ________________________________ From: SPSSX(r) Discussion on behalf of Spousta Jan Sent: Thu 11/23/2006 3:04 AM To: [hidden email] Subject: Re: Find and Replace Hi Hans, For "hard" replacement, one uses RECODE (Menu Transform->Recode->Into different variables). But in most cases it is better to leave the data untouched and use Value labels. In the data editor, choose the Variable View, find the variable and click in the column values. And then fill in pairs "value - label" (e.g. Value 1, label January) and click Add after each pair. Then in the output, if you wish, ones will be replaced with "January" etc. It is good to read the section about value labels in a manual (how to turn them off, how to change them etc.). Or ask here for further details. HTH Jan -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of SPSS Chen Sent: Thursday, November 23, 2006 3:46 AM To: [hidden email] Subject: Find and Replace Dear SPSS Lister: I have a variable in a dataset which have a column named Month as follow RecordNumber Month 1 1 2 2 3 5 4 12 Could you tell me how I use SPSS to find and replace the 1 to January, 2 to February, 3 to March...... 12 to December. Thanks for your help! Hans Chen |
Free forum by Nabble | Edit this page |