Someone gave me a data set with 549 rows of data. The first row corresponded to observations on 06/01/2003, the second to 06/02/2003, and so forth through 11/30/2004. She wanted to know how to get those particular dates in a column without having to type something into each individual cell.
Here's how I did it.
First, I defined a new column, date1, that has a date format. Then I used TRANSFORM | COMPUTE to calculate the following formula:
This gives you dates starting on June 1, 2003 and moving up day by day in each row.
She also wanted a column designating the particular month. You can do this with the same TRANSFORM | COMPUTE command to compute a new variable, MONTH, using the formula
Since you have June in both 2003 and 2004, you probably also need to compute a YEAR variable using the formula
This is a very simple example of date calculations in SPSS. I have another page that talks about this:
and version 13 of SPSS has a very useful date and time wizard:
but the best resource for these types of things is on Raynald Levesque's web site:
- Dates Tutorial. Levesque R. Accessed on 2001-09-07. pages.infinit.net/rlevesqu/LearningSyntax.htm#DateTutorial
You can find an earlier version of this page on my original website.