Date: Thu, 4 Aug 2005 16:03:06 +0200
Reply-To: Marta García-Granero
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Marta García-Granero
Organization: Asesoría Bioestadística
Subject: Re: Date calculations
Content-Type: text/plain; charset=ISO-8859-1
As some people at the list has already told you, the dates are stored
in seconds, and a fairly good formula for age is:
compute ageatapp = (app_date - dob)/31557600.
(assuming an average lenght of 365.25 days per year). Nonetheless, we
discussed this topic a while ago in the list, and Art Kendall gave a
wonderful lesson of different ways of computing age, showing that the
simple formula above would give wrong results if app_date was someone's
birthday and it was not a leap year. The code I turned into a macro
was written by him, and is absolutely accurate.
If, as Jon Peck pointed in another message, you have SPSS 13, then you
can forget the macro and use a built-in function to compute age.
BS> Thank you-- but Holy smokes, does it have to be that complicated????
BS> Or is it that the Date format inherently resists numerical manipulation?
BS> What unit are dates recorded in? Isn't it, in essence, "Days since X" where
BS> X is some arbitrary point of origin?
BS> If it is in days, why can't I just subtract DOB from APP_DATE, and then
BS> divide by some constant to convert the underlying unit to years? If the
BS> base unit isn't days, what is it?
BS> If one really must write 16 lines of code in order to perform numerical
BS> operations on dates, then the date format is *very badly* designed, IMHO!
I have a collection of macros with some statistical procedures and
functions not covered by SPSS. I know I need to run the file only once
(when I start the program), and then computing an age variable is as
simple as a macro call.