Date: Tue, 20 Apr 1999 09:45:19 -0500
Reply-To: gregg.asher@mankato.msus.edu
Sender: "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From: "Gregg W. Asher" <gregg.asher@MANKATO.MSUS.EDU>
Subject: Re: computing age
In-Reply-To: <78CB22DAF2C1D2118C9800A024CDCB64181BFB@hermes.spss.com.139.137.206.in-addr.arpa>
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
What form must the dob be in? How is the variable defined - as date?
Thanks
Gregg Asher
On Tue, 20 Apr 1999 09:18:06 -0500 "Tverdek, Edward" <etverdek@SPSS.COM> wrote:
> John,
>
> The SPSS system variable $TIME holds the current system date and
> time, and can be used in transformations such as this one. You
> can also simplify Jeremy's suggestion somewhat by using the
> CTIME.DAYS date conversion function to convert the difference
> between the current date and the date of birth (stored in seconds)
> to days. To express the age in years, the only arithmetic left
> would be to divide the days by 365.25. This fairly simple command
> will return the "age" of a case given a date-of-birth (dob) variable:
>
> COMPUTE age=CTIME.DAYS($TIME-dob)/365.25.
>
> I hope this helps,
>
> Ed Tverdek
> SPSS Technical Support
>
>
>
> -----Original Message-----
> From: John Mitchell [mailto:mitchell@earinc.net]
> Sent: Tuesday, April 20, 1999 9:05 AM
> To: SPSSX-L@UGA.CC.UGA.EDU
> Subject: Re: computing age
>
>
> Sorry to barge in on this conversation. Jeremy - do you (or does anyone else
> out there) know a way to use the system date in syntax so that the
> calculation of age can be automated and repeated on any given day without
> rewriting code?
>
> Thanks.
>
> John Mitchell
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:SPSSX-L@UGA.CC.UGA.EDU]On Behalf Of
> Jeremy Miles
> Sent: Tuesday, April 20, 1999 8:35 AM
> To: SPSSX-L@UGA.CC.UGA.EDU
> Subject: Re: computing age
>
>
> At 07:35 20/04/99 -0500, Sue O'Donnell wrote:
> > Any ideas? Thanks! Susan L. O'Donnell
> >
>
> To calculate someone's age, we subtract their birth data from the current
> date. We have to give the current date to SPSS using the date.dmy function.
>
> Use compute to calculate age as being equal to d.o.b - date.dmy(23, 2, 99)
> [or whatever is today's date].
>
> However, this will give age in seconds (because of the way that SPSS stores
> time. To calculate age, we must calculate age_in_years = age-in_seconds /
> (60 * 60 * 24 * 365.25).
>
>
> =====================================================================
> Jeremy Miles j.n.v.miles@derby.ac.uk
> Phone: 01332 622222 x3138 Fax: 01332 622287 Mobile: 07971 218172
> Inst. of Behavioural Sciences, Derby University, Derby, DE22 3HL,UK
> ================ http://ibs.derby.ac.uk/~jeremym ====================
----------------------
Gregg W. Asher, Ph.D.
Minnesota State University, Mankato
321 Maywood
MSU 235 P.O. Box 8400
Mankato, MN. 56002-8400
gregg.asher@mankato.msus.edu
|