The following seems to work:
DATA LIST LIST/date (A10) time(A10).
BEGIN DATA
2/20/2020 17:16:01
2/20/2020 10:24:22
2/20/2020 14:38:45
END DATA.
DATASET NAME datetime WINDOW=FRONT.
COMPUTE dt=NUMBER(date,ADATE10).
COMPUTE tt=NUMBER(time,TIME8).
COMPUTE ct=dt+tt.
EXECUTE.
FORMATS dt(ADATE10) tt(TIME8) ct(YMDHMS22).
But you get the ISO format for the combined date and time variable, I don't know if there is any format for mm-dd-yyy hh:mm:ss
Robert
-----Ursprungligt meddelande-----
Från: SPSSX(r) Discussion [mailto:
[hidden email]] För Empi
Skickat: den 27 februari 2020 08:02
Till:
[hidden email]
Ämne: Date & "Alter type"
Dear all,
I have a string-variable indicating dates in the following format:
2/20/2020 17:16:01
2/20/2020 10:24:22
2/20/2020 14:38:45
I wonder how to convert these string-data in SPSS date-variables. I thought that "alter type" might work but did not succeed - can anybody help me out here? How could such strings be converted to date variables ?
Greetings,
E.
--
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
=====================
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
Robert Lundqvist