Calculate Age

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

Calculate Age

drmmmcmillian@gmail.com
Hi everyone,

I am trying to calculate age using Datediff, but the month and year for the interview and birth dates are listed as separate variables (i.e., imonth, iyear, birthmon, and birthyear). How can I combine these, so I can use Datediff?


Best,
Monique

--------------------------------------------------------------
Associate Professor at Morgan State University/Guest Affiliate at Duke University
co-PI/Texas State University/NASA, MSI TEN
Teacher Education and Professional Development
1700 E. Cold Spring Lane
Banneker Hall 211D
Baltimore, Maryland 21251
Telephone: 443-885-1985
Fax: 443-885-8243
------------------------------------------------------------




===================== 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: Calculate Age

PRogman
See FM on date functions (and formats). If you don't have a day, choose one
(e.g. 15).

compute birthDate = date.dmy(birthday, birthmonth, birthyear).
compute iDate      = date.dmy(iday,       imonth,       imonth).
formats  birthDate iDate    (adate10)  /*or other preferred format*/.

compute Age = DATEDIFF(iDate, birthDate, 'years').
execute.

/PRogman


[hidden email] wrote

> Hi everyone,
>
> I am trying to calculate age using Datediff, but the month and year for
> the
> interview and birth dates are listed as separate variables (i.e., imonth,
> iyear, birthmon, and birthyear). How can I combine these, so I can use
> Datediff?
>
>
> Best,
> Monique
>
> --------------------------------------------------------------
> Marciea *Monique *McMillian, Ph.D.
> <http://mcmillian.socialpsychology.org/>
> Associate Professor at Morgan State University/Guest Affiliate at Duke
> University
> co-PI/Texas State University/NASA, MSI TEN
> Teacher Education and Professional Development
> 1700 E. Cold Spring Lane
> Banneker Hall 211D
> Baltimore, Maryland 21251
> Telephone: 443-885-1985
> Fax: 443-885-8243

> marciea.mcmillian@

> ------------------------------------------------------------
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Calculate Age

drmmmcmillian@gmail.com
Thank you!


--------------------------------------------------------------
Associate Professor at Morgan State University/Guest Affiliate at Duke University
co-PI/Texas State University/NASA, MSI TEN
Teacher Education and Professional Development
1700 E. Cold Spring Lane
Banneker Hall 211D
Baltimore, Maryland 21251
Telephone: 443-885-1985
Fax: 443-885-8243
------------------------------------------------------------





On Mon, May 28, 2018 at 1:06 PM, PRogman <[hidden email]> wrote:
See FM on date functions (and formats). If you don't have a day, choose one
(e.g. 15).

compute birthDate = date.dmy(birthday, birthmonth, birthyear).
compute iDate      = date.dmy(iday,       imonth,       imonth).
formats  birthDate iDate    (adate10)  /*or other preferred format*/.

compute Age = DATEDIFF(iDate, birthDate, 'years').
execute.

/PRogman


[hidden email] wrote
> Hi everyone,
>
> I am trying to calculate age using Datediff, but the month and year for
> the
> interview and birth dates are listed as separate variables (i.e., imonth,
> iyear, birthmon, and birthyear). How can I combine these, so I can use
> Datediff?
>
>
> Best,
> Monique
>
> --------------------------------------------------------------
> Marciea *Monique *McMillian, Ph.D.
> &lt;https://urldefense.proofpoint.com/v2/url?u=http-3A__mcmillian.socialpsychology.org_-26gt-3B&d=DwICAg&c=0CCt47_3RbNABITTvFzZbA&r=Gc5PfDWm282I0EvobgHZCTV1EYOrYiJwzPud4BgfjuU&m=k7kvA2cZPY9yEMMfZ9RpXqIv-g4TDW8XjZT9Hhry8D4&s=53FoxTsfl1qPXoPbWX9mV-GKZbH0nGqUhyPK-OZI8F4&e=
> Associate Professor at Morgan State University/Guest Affiliate at Duke
> University
> co-PI/Texas State University/NASA, MSI TEN
> Teacher Education and Professional Development
> 1700 E. Cold Spring Lane
> Banneker Hall 211D
> Baltimore, Maryland 21251
> Telephone: 443-885-1985
> Fax: 443-885-8243

> marciea.mcmillian@

> ------------------------------------------------------------
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (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





--
Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__spssx-2Ddiscussion.1045642.n5.nabble.com_&d=DwICAg&c=0CCt47_3RbNABITTvFzZbA&r=Gc5PfDWm282I0EvobgHZCTV1EYOrYiJwzPud4BgfjuU&m=k7kvA2cZPY9yEMMfZ9RpXqIv-g4TDW8XjZT9Hhry8D4&s=eqkKZyNSBdisrWv1tvsLK4JBkdP3_2ceqiWe9Vj-zE4&e=

=====================
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

===================== 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