1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
*Here is a small bit of code to convert a string formatted as hhmmss into a
numeric variable (TIME8 format).
* Jim Marks 2002/03/21.

DATA LIST /time_0 (a6).

BEGIN DATA
001520
123456
230110
END DATA.
STRING #time_00 (A8).
COMPUTE #time_00 =
	CONCAT(SUBSTR(time_0,1,2),':',SUBSTR(time_0,3,2),':',SUBSTR(time_0,5,2)).
COMPUTE time = NUMBER(#time_00,TIME8).
FORMATS time (TIME8).
EXECUTE.