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.

68 Universals<br />

XDATE.WEEK(arg) Return the week number of a date. The result is an integer between 1<br />

and 53. The date must have occurred after October 14, 1582. For<br />

example, you can extract the week number from BIRTHDAY, as in<br />

COMPUTE WEEKNUM=XDATE.WEEK(BIRTHDAY).<br />

When the value for BIRTHDAY is 5-DEC-1954 05:30:15, this command<br />

returns the value 49 for WEEKNUM.<br />

XDATE.TDAY(arg) Return number of days in a time interval or from October 14, 1582.<br />

The value returned is an integer (the fractional portion of a day is ignored).<br />

For example, the command<br />

COMPUTE NDAYS=XDATE.TDAY(BIRTHDAY).<br />

returns the value 135922 when the value for BIRTHDAY is 05-DEC-1954<br />

5:30:15, indicating the number of days between October 14, 1582 and<br />

December 5, 1954. The hours, minutes, and seconds are ignored.<br />

XDATE.TIME(arg) Return time of day from a date. The result is expressed as the number<br />

of elapsed seconds since midnight of that date. For example, when the<br />

value for BIRTHDAY is 05-DEC-1954 5:30:15, the command<br />

COMPUTE ELSEC=XDATE.TIME(BIRTHDAY).<br />

returns the value 19815 for ELSEC. If you provide a TIME print format,<br />

as in<br />

PRINT FORMAT ELSEC(TIME8).<br />

the value is displayed as 5:30:15.<br />

XDATE.DATE(arg) Return the date portion of a date. The result is the integral date portion<br />

of a date, which is the number of elapsed seconds between midnight<br />

October 14, 1582 and midnight of the date in question. The date must<br />

have occurred after October 14, 1582. To extract the date from variable<br />

BIRTHDAY, use<br />

COMPUTE BRTHDATE=XDATE.DATE(BIRTHDAY).<br />

The value for BIRTHDATE can then be displayed as 12/05/54 using<br />

ADATE8 format.

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

Saved successfully!

Ooh no, something went wrong!