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 (October 2002)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 4 Oct 2002 00:22:11 -0400
Reply-To:     Mark Casazza <mark.casazza@verizon.net>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Mark Casazza <mark.casazza@verizon.net>
Subject:      Re: calculating numeric age from date of birth??
Comments: To: Mark Casazza <Mark.Casazza@domino1.cuny.edu>
In-Reply-To:  <KNEEKMIBLEIMGDOCDPCOGEAMCBAA.Mark.Casazza@mail.cuny.edu>

Hi Stephen,

One more time. I spotted a logic problem in the second set of commands (calculating the number of years, months, days). The following version appears to be correct. Someone check me on this... It's getting late in NYC :)

Mark

-- DATA LIST LIST/ bdate (adate). BEGIN DATA 02/07/75 11/01/81 12/13/76 END DATA.

NUMERIC age (f4.1). COMPUTE age = CTIME.DAYS(DATE.MDY(9,1,2002) - bdate) / 365.25. LIST.

NUMERIC yr (F2). NUMERIC mo (F2). NUMERIC da (F2).

COMPUTE yr = (2002-XDATE.YEAR(bdate)). DO IF XDATE.MONTH(bdate) LE 9. . COMPUTE mo = (9 - XDATE.MONTH(bdate)). ELSE. . COMPUTE mo = (12 - XDATE.MONTH(BDATE) + 9). . COMPUTE yr = yr - 1. END IF. COMPUTE da = (XDATE.MDAY(bdate)-1). LIST. --

> -----Original Message----- > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] > On Behalf Of Mark Casazza > Sent: Thursday, October 03, 2002 4:56 PM > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: Re: calculating numeric age from date of birth?? > > > Hi Stephen, > > See if this does what you need. I used September 1, 2002 as > the date to > calculate from (which it appears you did also). If you want to use a > different day, just set up a DO IF structure like I did for month. > > -- > DATA LIST LIST/ bdate (adate). > BEGIN DATA > 02/07/75 > 11/01/81 > END DATA. > > NUMERIC age (f4.1). > COMPUTE age = CTIME.DAYS(DATE.MDY(9,1,2002) - bdate) / 365.25. > LIST. > > NUMERIC yr (F2). > NUMERIC mo (F2). > NUMERIC da (F2). > > COMPUTE yr = (2002-XDATE.YEAR(bdate)). > DO IF XDATE.MONTH(bdate) LE 9. > . COMPUTE mo = (9 - XDATE.MONTH(bdate)). > ELSE. > . COMPUTE mo = (XDATE.MONTH(BDATE)-9). > END IF. > COMPUTE da = (XDATE.MDAY(bdate)-1). > LIST. > -- > > Mark V. Casazza > Director of Academic Information > The City University of New York > 555 W. 57th St. Suite 1240 > New York, NY 10019 > > phone: 212.541.0396 > fax: 212.541.0392 > email: Mark.Casazza@mail.cuny.edu > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On > Behalf Of > Stephen J. Toglia > Sent: Thursday, October 03, 2002 3:47 PM > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: calculating numeric age from date of birth?? > > > For part of my assignment I have to calculate participants > numeric age from > the date of birth. For example, 02/07/75 would equal 27 > years, 7 months, > and 6 days or 27.6...by using syntax how can do this. Any > guidance is much > appreciated!! > > thanks > > > > "Beauty, truth, friendship, love, creation - these are the > great values of life. We can't prove them, or explain them, > yet they are the > most stable things in our lives." > > > > > --------------------------------- > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! >


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