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.

Aggregation Functions<br />

Date and Time 63<br />

Aggregation functions generate dates and time intervals from values that were not read by<br />

date and time input formats.<br />

• All aggregation functions begin with DATE or TIME, depending on whether a date or a time<br />

interval is requested. This is followed by a subfunction that corresponds to the type of<br />

values found in the data.<br />

• The subfunctions are separated from the function by a period (.) and are followed by an<br />

argument list specified in parentheses.<br />

• The arguments to the DATE and TIME functions must be separated by commas and must<br />

contain integer values.<br />

DATE.DMY(d,m,y) Combine day, month, and year. The value of the argument for day<br />

must be expressed as an integer between 1 and 31. The value of the<br />

argument for month must be expressed as an integer between 1 and 13<br />

(13 returns January of the following year). Years should be expressed<br />

in four digits. For example, the command<br />

COMPUTE BIRTHDAY=DATE.DMY(DAY,MONTH,YEAR).<br />

stores the value of approximately 1.184E+10 in BIRTHDAY when DAY<br />

is 8, MONTH is 11, and YEAR is 57. This value can be displayed with<br />

a DATE9 format as 08-NOV-57.<br />

DATE.MDY(m,d,y) Combine month, day, and year. This function follows the same rules<br />

as DATE.DMY, except for the order of the arguments. For example, the<br />

command<br />

COMPUTE BIRTHDAY=DATE.MDY(MONTH,DAY,YEAR).<br />

stores the same value as the previous example in BIRTHDAY for the<br />

same values of MONTH, DAY, and YEAR. The value can be displayed<br />

as 11/08/57 with an ADATE8 format.<br />

DATE.YRDAY(y,d) Combine year and day of the year. The year can be expressed as either<br />

two or four digits. Years should be expressed in four digits. The day<br />

can be expressed as any integer between and including 1 and 366. For<br />

example, the command<br />

COMPUTE BIRTHDAY=DATE.YRDAY(1688,301).<br />

when combined with a DATE11 print format produces the date<br />

27-OCT-1688 for BIRTHDAY.<br />

DATE.QYR(q,y) Combine quarter and year. The quarter must be expressed as a single<br />

digit between and including 1 and 4. The year can contain two or<br />

four digits. Years should be expressed in four digits. For example,<br />

the command<br />

COMPUTE QUART=DATE.QYR(QTR,YEAR).<br />

with a QDATE6 print format produces a value of 4 Q 57 for QUART<br />

when QTR is 4 and YEAR is 57. Since each quarter is assumed to begin

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

Saved successfully!

Ooh no, something went wrong!