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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Date and Time 67<br />

XDATE.HOUR(arg) Return the hour from a date or time of day. The result is an integer between<br />

0 and 23. For example, you can extract the hour from BIRTHDAY,<br />

as in<br />

COMPUTE HOUR=XDATE.HOUR(BIRTHDAY).<br />

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

returns 5 for HOUR.<br />

XDATE.MINUTE(arg) Return the minute of the hour from a date or time of day. The result is<br />

an integer from 0 through 59. For example, you can extract the minute<br />

of the hour from BIRTHDAY, as in<br />

COMPUTE MIN=XDATE.MINUTE(BIRTHDAY).<br />

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

returns 30 for MIN.<br />

XDATE.SECOND(arg) Return the second of the minute from a date or time of day. The result is<br />

an integer or, if there are fractional seconds, a value with decimals. For<br />

example, you can extract the second of the minute from BIRTHDAY, as in<br />

COMPUTE SEC=XDATE.SECOND(BIRTHDAY).<br />

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

returns a value of 15.00 for SEC.<br />

XDATE.WKDAY(arg) Return the day within a week from a date. The result is an integer between<br />

and including 1 and 7, with Sunday being 1 and Saturday being<br />

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

you can extract the day of the week from BIRTHDAY, as in<br />

COMPUTE DAYNAME=XDATE.WKDAY(BIRTHDAY).<br />

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

returns the value 1 for DAYNAME. If you provide an output format of<br />

WKDAY, as in<br />

PRINT FORMAT DAYNAME (WKDAY9).<br />

the value for DAYNAME would display as SUNDAY.<br />

XDATE.JDAY(arg) Return the day of the year from the date. The result is an integer<br />

between 1 and 366 inclusive. The date must have occurred after<br />

October 14, 1582. For example, you can extract the day of the year<br />

from BIRTHDAY, as in<br />

COMPUTE DAYNUM=XDATE.JDAY(BIRTHDAY).<br />

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

returns the value 339 for DAYNUM.<br />

XDATE.QUARTER(arg) Return quarter number within a year for a date. The result is 1, 2, 3,<br />

or 4. The date must have occurred after October 14, 1582. To extract<br />

the quarter in which BIRTHDAY occurred, use the command<br />

COMPUTE Q=XDATE.QUARTER(BIRTHDAY).<br />

When BIRTHDAY equals 5-DEC-1954 05:30:15, the value of Q is 4.

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

Saved successfully!

Ooh no, something went wrong!