String Date into Numeric Date

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

String Date into Numeric Date

Mario Giesel
Hello, all,

I've got several string variables (A10) which I want to convert into date formats.
Here's how they look like:

date001  date002
2002-05-08 2002-07-01
2002-05-02 2002-06-11
2002-03-26 2002-05-08
2002-05-06 2002-09-25
2002-03-26 2002-11-12
...

I need to compute the number of days between two successive dates.
Any proposals for the convertion?

Thanks a lot!
Mario




====================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
Mario Giesel
Munich, Germany
Reply | Threaded
Open this post in threaded view
|

Re: String Date into Numeric Date

Oliver, Richard
do repeat x=date001 date002 /y=numdate1 numdate2.
compute y=number(x, sdate10).
end repeat.
formats numdate1 numdate2 (sdate10).

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mario Giesel
Sent: Tuesday, January 20, 2009 11:16 AM
To: [hidden email]
Subject: String Date into Numeric Date

Hello, all,

I've got several string variables (A10) which I want to convert into date formats.
Here's how they look like:

date001  date002
2002-05-08 2002-07-01
2002-05-02 2002-06-11
2002-03-26 2002-05-08
2002-05-06 2002-09-25
2002-03-26 2002-11-12
...

I need to compute the number of days between two successive dates.
Any proposals for the convertion?

Thanks a lot!
Mario




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

AW: String Date into Numeric Date

Mario Giesel
Thanks to Mark and Richard for the hint on the "SDATE10" function.

I had tried it with "DATE10" - but to no avail.


@ Mark: Rereading the data with DATA LIST would have been a bit cumbersome as the database is huge.
@ Richard: The additional "formats numdate1 numdate2 (sdate10)." was very helpful

Good luck to you!

Mario




________________________________
Von: "Oliver, Richard" <[hidden email]>
An: [hidden email]
Gesendet: Dienstag, den 20. Januar 2009, 19:21:54 Uhr
Betreff: Re: String Date into Numeric Date

do repeat x=date001 date002 /y=numdate1 numdate2.
compute y=number(x, sdate10).
end repeat.
formats numdate1 numdate2 (sdate10).

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mario Giesel
Sent: Tuesday, January 20, 2009 11:16 AM
To: [hidden email]
Subject: String Date into Numeric Date

Hello, all,

I've got several string variables (A10) which I want to convert into date formats.
Here's how they look like:

date001  date002
2002-05-08 2002-07-01
2002-05-02 2002-06-11
2002-03-26 2002-05-08
2002-05-06 2002-09-25
2002-03-26 2002-11-12
...

I need to compute the number of days between two successive dates.
Any proposals for the convertion?

Thanks a lot!
Mario




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





====================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
Mario Giesel
Munich, Germany