LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 31 Jan 2005 21:39:11 -0500
Reply-To:     Richard Ristow <wrristow@mindspring.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <wrristow@mindspring.com>
Subject:      Re: convert numeric year into date variable
Comments: To: Martin Sherman <MSherman@loyola.edu>
In-Reply-To:  <s1fe9eb4.072@GWMAIL01.LOYOLA.EDU>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 09:09 PM 1/31/2005, Martin Sherman wrote:

>I have checked out Raynald Levesque's web site on how to convert a >numeric year (1978) into a date variable but have had no luck. Does >anyone know the syntax to convert a numeric value of year into a date >variable.

First, be sure you know: An SPSS date can't be just a year. It's always a specific day -- in fact, a specific second. And I don't see a date format to display only the 'year' part.

That said, if variable YEAR is a 4-digit year (e.g. 1978), and you want an SPSS date variable (which I'll call YEAR_DT) for midnight beginning the first of January of that year,

COMPUTE YEAR_DT = DATE.MDY(1,1,YEAR). FORMATS YEAR_DT (MOYR8).

The "MOYR8" format will display your date as "JAN 1978", which isn't ideal. Chose whatever date format seems best; see the syntax manual. I wanted to give some date format, though, as displaying dates in non-date formats can be utterly confusing.

You don't have to use the beginning of the year, of course. If you want the 'year' to be the middle of the year, like the first of July,

COMPUTE YEAR_DT = DATE.MDY(7,1,YEAR). FORMATS YEAR_DT (MOYR8).


Back to: Top of message | Previous page | Main SPSSX-L page