|
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? |
|
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
|
|
Administrator
|
In reply to this post by Khaleel Hussaini
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/). |
|
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 |
|
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:
|
| Free forum by Nabble | Edit this page |
