query in spss

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

query in spss

Manoj Soni

Dear listers.

 

How can we calculate age in days  from today’s date , if original date of birth is recorded in three different variables, i.e. day, month and year.

Thanks in advance.

Regards

Manoj

Reply | Threaded
Open this post in threaded view
|

Re: query in spss

Maguin, Eugene
Manoj,
 
Use the YRMODA function. Look this function up in help or CSR but like this
 
ageindays=yrmoda(todayyear,todaymonth,todayday)-yrmoda(dobyear,dobmonth,dobday)-
 
Gene Maguin


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Manoj Soni
Sent: Wednesday, May 18, 2011 8:29 AM
To: [hidden email]
Subject: query in spss

Dear listers.

 

How can we calculate age in days  from today’s date , if original date of birth is recorded in three different variables, i.e. day, month and year.

Thanks in advance.

Regards

Manoj

Reply | Threaded
Open this post in threaded view
|

Re: query in spss

David Marso
Administrator
In reply to this post by Manoj Soni
Something like (Untested -no SPSS installed on my Mac OSX partition-)
COMPUTE AGETODAY=CTIME.DAYS($DATE-DATE.MDY(Month,Day,Year)).


Manoj Soni wrote
Dear listers.

How can we calculate age in days  from today's date , if original date of
birth is recorded in three different variables, i.e. day, month and year.

Thanks in advance.

Regards

Manoj
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: query in spss

David Marso
Administrator
In reply to this post by Maguin, Eugene
I generally avoid YRMODA like the plague.
1.  It does not return a value in the same metric as other date conversion DATE.xxx functions (seconds).
2.  It does not play nice with other date functions (it must be multiplied by 86400 first).
3.  It is a throwback to SPSS-PC+ and the *OLD* pre SPSS-X mainframe versions.

Gene Maguin wrote
Manoj,

Use the YRMODA function. Look this function up in help or CSR but like this

ageindays=yrmoda(todayyear,todaymonth,todayday)-yrmoda(dobyear,dobmonth,dobd
ay)-

Gene Maguin

  _____

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Manoj Soni
Sent: Wednesday, May 18, 2011 8:29 AM
To: [hidden email]
Subject: query in spss



Dear listers.



How can we calculate age in days  from today's date , if original date of
birth is recorded in three different variables, i.e. day, month and year.

Thanks in advance.

Regards

Manoj
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: query in spss

Jon K Peck
In reply to this post by Maguin, Eugene
To add to Gene's solution, you may find the Date and Time wizard on the Transform menu helpful in figuring out how to manipulate date and time data.

Jon Peck
Senior Software Engineer, IBM
[hidden email]
new phone: 720-342-5621




From:        Gene Maguin <[hidden email]>
To:        [hidden email]
Date:        05/18/2011 10:04 AM
Subject:        Re: [SPSSX-L] query in spss
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Manoj,
 
Use the YRMODA function. Look this function up in help or CSR but like this
 
ageindays=yrmoda(todayyear,todaymonth,todayday)-yrmoda(dobyear,dobmonth,dobday)-
 
Gene Maguin


From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Manoj Soni
Sent:
Wednesday, May 18, 2011 8:29 AM
To:
[hidden email]
Subject:
query in spss


Dear listers.
 
How can we calculate age in days  from today’s date , if original date of birth is recorded in three different variables, i.e. day, month and year.
Thanks in advance.
Regards
Manoj