Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

converting string variable (time) into numeric variable

993 views
Skip to first unread message

ian

unread,
Nov 4, 2010, 6:48:23 PM11/4/10
to
I am trying to convert the time at which participants completed the
study (a string variable called "time") into a numeric variable so I
can control for it in a regression analysis. I have tried the compute
and recode commands, but when I do the following error message appears
for every piece of data SPSS tries to convert (in the example below
SPSS is trying to convert 11:00 into a numeric variable):

>Warning # 1102
>An invalid numeric field has been found. The result has been set to the
>system-missing value.
>Command line: 80 Current case: 1 Current splitfile group: 1
>Field contents: '11:00'

The variable is created, but the cells are blank. Could someone help
me with this please? : )


-Ian Zimmerman

JKPeck

unread,
Nov 4, 2010, 9:30:17 PM11/4/10
to

Try using the Date and Time wizard on the Transform menu to generate
the correct conversion code.

HTH,
Jon Peck

E van Haarst

unread,
Nov 17, 2010, 4:36:12 AM11/17/10
to
> Jon Peck- Hide quoted text -
>
> - Show quoted text -

In my experience importing goes wrong sometimes.
You might try to change the date-time format by using the following
syntax:
FORMATS time (DATETIME17.0) , results in dd-mmm-yyyy hh:mm (17 refers
to the number of text or numbers)
FORMATS time (DATETIME11.0) .
search the syntax help file for datetime to see all options.

To make it numeric you can use FORMATS time (F 2.0) , meaning 2
numbers, 0 digits.

good luck

0 new messages