27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

60 Universals<br />

The LIST output from these commands is shown in Figure 18.<br />

Figure 18 Output illustrating WKDAY and MONTH formats<br />

VAR1 VAR2 VAR3 VAR4 VAR5<br />

SUNDAY 1 JANUARY JAN 1<br />

MONDAY 2 FEBRUARY FEB 2<br />

TUESDAY 3 MARCH MAR 3<br />

WEDNESDAY 4 APRIL APR 4<br />

THURSDAY 5 OCTOBER OCT 10<br />

FRIDAY 6 NOVEMBER NOV 11<br />

SATURDAY 7 DECEMBER DEC 12<br />

Example<br />

DATA LIST FIXED /VAR1 1-14 (DTIME) VAR2 18-42 (DATETIME).<br />

BEGIN DATA<br />

20 8:3 20-6-90 8:3<br />

20:8:03:46 20/JUN/1990 8:03:46<br />

20 08 03 46.75 20 June, 2001 08 03 46.75<br />

END DATA.<br />

LIST.<br />

• DTIME and DATETIME read and write time intervals.<br />

• The decimal point explicitly coded in the input data for fractional seconds.<br />

• The DTIME format allows a − or + sign in the data value to indicate a time interval before<br />

or after a point in time.<br />

• Internally, values for a DTIME variable are stored as the number of seconds of the time<br />

interval while those for a DATETIME variable are stored as the number of seconds from 0<br />

hours, 0 minutes, and 0 seconds of Oct. 14, 1582.<br />

The LIST output from these commands is shown in Figure 19.<br />

Figure 19 Output illustrating DTIME and DATETIME formats<br />

VAR1 VAR2<br />

20 08:03:00 20-JUN-1990 08:03:00<br />

20 08:03:46 20-JUN-1990 08:03:46<br />

20 08:03:46 20-JUN-2001 08:03:46<br />

Arithmetic Operations with Date and Time Variables<br />

Most date and time variables are stored internally as the number of seconds from a particular<br />

date or as a time interval and therefore can be used in arithmetic operations:<br />

• A date is a floating-point number representing the number of seconds from midnight,<br />

October 14, 1582. Dates, which represent a particular point in time, are stored as the<br />

number of seconds to that date. For example, November 8, 1957, is stored as 1.2E+10.<br />

• A date includes the time of day, which is the time interval past midnight. When time of<br />

day is not given, it is taken as 00:00 and the date is an even multiple of 86,400 (the number<br />

of seconds in a day).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!