More help

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

More help

Khaleel Hussaini
I have the following data
child1_dob child2_dob  child3_dob child4_dob momDOB
01/10/2009 05/04/1990 07/08/2000 .               05/05/1975
02/13/2008 04/03/2007 05/06/1999  09/07/1998 04/04/1985

The objective is to find mom's age at the birth of first child. How can I develop an elegant syntax for such comparison?
Reply | Threaded
Open this post in threaded view
|

Re: More help

Mike
I could be wrong but I think the following does what you want:
 
compute momAGE_kid1=(((child1_dob - momDOB)/86400)/365.25).
 
This should return mom's age in years at first child's birth in years,
if I recall correctly.
 
-Mike Palij
New York University
 
----- Original Message -----
Sent: Friday, May 14, 2010 10:45 AM
Subject: More help

I have the following data
child1_dob child2_dob  child3_dob child4_dob momDOB
01/10/2009 05/04/1990 07/08/2000 .               05/05/1975
02/13/2008 04/03/2007 05/06/1999  09/07/1998 04/04/1985

The objective is to find mom's age at the birth of first child. How can I develop an elegant syntax for such comparison?
Reply | Threaded
Open this post in threaded view
|

Re: More help

Bruce Weaver
Administrator
In reply to this post by Khaleel Hussaini
Khaleel Hussaini wrote
 I have the following data
child1_dob child2_dob  child3_dob child4_dob momDOB
01/10/2009 05/04/1990 07/08/2000 .               05/05/1975
02/13/2008 04/03/2007 05/06/1999  09/07/1998 04/04/1985

The objective is to find mom's age at the birth of first child. How can I
develop an elegant syntax for such comparison?
Use the MIN function to pick out the earliest DOB among the children.  E.g.,

numeric first_child_dob (date11).
compute first_child_dob = min(child1_dob to child4_dob).

Then use FIRST_CHILD_DOB and MOMDOB as arguements in DATEDIFF to compute the mother's age.

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: More help

Michael Kruger
In reply to this post by Khaleel Hussaini
Khaleel,

this one is easy. compute 'Mage_FB' using functions: date arithmetic,
datediff starting with child1_dob. aThen do the same thing using
child2_dob and use the If 'Missing(Mage_FB)' jsut in case there is no
entry for child1_dob. If there are entries for all of the child1_dob,
then you should only have to use a single compute using the date
arithmetic function...

--

MICHAEL KRUGER
"A TRUE PRINCE"

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: More help

Khaleel Hussaini
In reply to this post by Bruce Weaver
Thanks again Bruce. That worked.
Khaleel.

On Fri, May 14, 2010 at 8:22 AM, Bruce Weaver <[hidden email]> wrote:
Khaleel Hussaini wrote:
>
>  I have the following data
> child1_dob child2_dob  child3_dob child4_dob momDOB
> 01/10/2009 05/04/1990 07/08/2000 .               05/05/1975
> 02/13/2008 04/03/2007 05/06/1999  09/07/1998 04/04/1985
>
> The objective is to find mom's age at the birth of first child. How can I
> develop an elegant syntax for such comparison?
>
>

Use the MIN function to pick out the earliest DOB among the children.  E.g.,

numeric first_child_dob (date11).
compute first_child_dob = min(child1_dob to child4_dob).

Then use FIRST_CHILD_DOB and MOMDOB as arguements in DATEDIFF to compute the
mother's age.



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://old.nabble.com/More-help-tp28560342p28560761.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD