SPSS Statistics Workbook For Dummies
Book image
Explore Book Buy On Amazon

Calendar and clock arithmetic can be tricky, but SPSS can handle it all for you. Just enter the date and time in whatever format you specify, and SPSS converts those values into its internal form to do the calculations. Also, SPSS displays the date and time in your specified format, so it's easy to read.

SPSS understands the meaning of slashes, commas, colons, blanks, and names in the dates and times you enter, so you can write the date and time almost any way you'd like. If SPSS can't figure out what you've typed, it clears away what you typed and waits for you to type something again.

Internally, SPSS keeps all dates as a positive or negative count of the number of seconds from a zero date. Here's a bit of trivia for you. The zero date in SPSS is the birth of the Gregorian calendar in 1582. No kidding! You can choose a display format that includes or excludes the time, but the information is always there. You can even change the display format without loss of data. If the time isn't included in the data you enter, SPSS assumes zero hours and minutes (midnight).

You determine the data type for each variable on the Data View tab of the Data Editor window. The type is chosen from the list of types shown here. On the right, you select a format. SPSS uses this format to interpret your input and to format the dates for display.

Select the data type and the ­format.
Select the data type and the ­format.

SPSS uses the format you select for both reading your input and formatting the output of dates and times.

The Columns setting of the date variable on the Variable View tab of the Data Editor window is important. The column width determines the maximum number of characters that can be displayed. If you choose a format that is too narrow to fit, the date will show up only as a row of asterisks.

The available formats are defined as a group and change according to the variable type. For example, the Dollar type has a different list of choices from those offered for the Date type.

The list of format definitions you have to choose from are constructed by combining the specifiers listed here. Format definitions look like mm/dd/yy and ddd:hh:mm.

Specifiers in Date and Time Formats
Specifier Means
dd A two-digit day of the month in the range 01, 02, . . . , 30, 31.
ddd A three-digit day of the year in the range 001, 002, . . . , 364, 365.
hh A two-digit hour of the day in the range 00, 01, . . . , 22, 23.
Jan, Feb, . . . The abbreviated name of the month of the year, as in JAN, FEB, . . . , NOV, DEC.
February, . . .
The name of the month of the year, as in JANUARY, FEBRUARY, . . . , NOVEMBER, DECEMBER.
mm When adjacent to a dd specifier in a format, a two-digit month of the year in the range 01, 02, . . . , 11, 12.
When adjacent to an hh specifier in a format, a two-digit specifier of the minute in the range 00, 01, . . . , 58, 59.
mmm A three-character name of a month, as in JAN,
FEB, . . . , NOV, DEC.
Mon, Tue, . . . The abbreviated name of the day of the week, as in MON, TUE, . . . , SAT, SUN.
Tuesday, . . .
The name of the day of the week, as in MONDAY, TUESDAY, . . . , SATURDAY, SUNDAY.
q Q The quarter of the year, as in 1 Q, 2 Q, 3 Q, or 4 Q.
Ss Following a colon, the number of seconds in the range 00, 01, . . . , 58, 59. Following a period, the number of hundredths of a second.
ww WK The one- or two-digit number of the week of the year in the range 1 WK, 2 WK, . . . , 51 WK, 52 WK. Note: Although week numbers can be either one or two digits, the numbers always line up when printed in columns because SPSS inserts a blank in front of single-digit numbers.
yy A two-digit year in the range 00, 01, . . . , 98, 99. The assumed first two digits of the four-digit year this represents are determined by the configuration found at Edit → Options → Data.
yyyy A four-digit year in the range 0001, 0002, . . ., 9998, 9999.

You can go back and change the format of a date variable at any time without fear of losing information. For example, you could enter the data under a format that accepted only the year, month, and day, and then change the format to something that contains only the hours and minutes. The format may not display all the information you entered (in fact, in this case, it won't), but when you change the format back to something more inclusive, all your data is still there.

To enter data, choose a format — any format — that contains all the data you have. You can later change to a more limited format that displays only the information you want. But you can't go the other way. If you later choose a format that doesn't leave parts out, you see the defaults that were inserted by SPSS when you entered the data.

About This Article

This article can be found in the category: