Age / Date

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

Age / Date

Nyougo Omae.
Hello,

I have a dataset with an age variable entered as yy:mm:dd that I would like to convert to months. When I checked through the 'help' section in SPSS, this doesn't appear as one of the date formats ( I was hoping I could find this there). Please help.

Thank you.
Nyougo.

=====================
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: Age / Date

Jason Burke
To extract the MM from the variable age, use the following command:

COMPUTE MonthOfYear = XDATE.MONTH(age) .
EXECUTE.

HTH,


Jason

On 3/4/08, Nyougo Omae. <[hidden email]> wrote:

> Hello,
>
> I have a dataset with an age variable entered as yy:mm:dd that I would like to convert to months. When I checked through the 'help' section in SPSS, this doesn't appear as one of the date formats ( I was hoping I could find this there). Please help.
>
> Thank you.
> Nyougo.
>
> =====================
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Age / Date

Richard Ristow
In reply to this post by Nyougo Omae.
At 03:34 PM 3/3/2008, Nyougo Omae. wrote:

>I have a dataset with an age variable entered as yy:mm:dd that I
>would like to convert to months.

This is one of the few times I wouldn't convert to SPSS date format.

If your variable is AGE, and you want MONTHS, try this. (It's not
tested; and it ignores the 'days' part of AGE)

COMPUTE MONTHS = 12*NUMBER(SUBSTR(AGE,1,2),F2) /* Years  */
                  +  NUMBER(SUBSTR(AGE,4,2),F2) /* Months */.




>  When I checked through the 'help' section in SPSS, this doesn't
> appear as one of the date formats ( I was hoping I could find this
> there). Please help.
>
>Thank you.
>Nyougo.
>
>=====================
>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
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Free Edition.
>Version: 7.5.516 / Virus Database: 269.21.3/1307 - Release Date:
>3/2/2008 3:59 PM

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